Commit ca37fd61 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Properly parse hostname in v2 network status.

parent 9c7e1b9a
......@@ -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
......
......@@ -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]);
}
......
......@@ -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());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment