Properly parse hostname in v2 network status.

This commit is contained in:
Karsten Loesing 2019-11-20 17:53:54 +01:00
parent 9c7e1b9a54
commit ca37fd616c
3 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,8 @@
* Minor changes
- Fix a NullPointerException when parsing an invalid crypto block
starting with "-----END " rather than "-----BEGIN ".
- Properly parse an authority's hostname from the "dir-source" line
in a v2 network status.
# Changes in version 2.9.1 - 2019-11-09

View File

@ -181,6 +181,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl
throw new DescriptorParseException("Illegal hostname in '" + line
+ "'.");
}
this.hostname = parts[1];
this.address = ParseHelper.parseIpv4Address(line, parts[2]);
this.dirPort = ParseHelper.parsePort(line, parts[3]);
}

View File

@ -60,6 +60,7 @@ public class RelayNetworkStatusImplTest {
new int[] { 0, statusBytes.length }, null);
assertEquals(rnsi.getContactLine(),
"1024R/8D56913D Alex de Joode <adejoode@sabotage.org>");
assertEquals("194.109.206.212", rnsi.getHostname());
}
}