[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-lib/master] Accept extra-info-digest lines with additional digests.
commit bd18dd0d2f788d1d4ee7acbac5032e97264bb855
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Fri May 29 15:24:00 2015 +0200
Accept extra-info-digest lines with additional digests.
---
.../torproject/descriptor/impl/ServerDescriptorImpl.java | 2 +-
.../descriptor/impl/ServerDescriptorImplTest.java | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
index cf24904..c070cc1 100644
--- a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
+++ b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
@@ -401,7 +401,7 @@ public class ServerDescriptorImpl extends DescriptorImpl
private void parseExtraInfoDigestLine(String line, String lineNoOpt,
String[] partsNoOpt) throws DescriptorParseException {
- if (partsNoOpt.length != 2) {
+ if (partsNoOpt.length < 2) {
throw new DescriptorParseException("Illegal line '" + line + "'.");
}
this.extraInfoDigest = ParseHelper.parseTwentyByteHexString(line,
diff --git a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
index b593e21..c7f9df4 100644
--- a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
+++ b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
@@ -709,6 +709,19 @@ public class ServerDescriptorImplTest {
}
@Test()
+ public void testExtraInfoDigestAdditionalDigest()
+ throws DescriptorParseException {
+ String extraInfoDigest = "0879DB7B765218D7B3AE7557669D20307BB21CAA";
+ String additionalExtraInfoDigest =
+ "V609l+N6ActBveebfNbH5lQ6wHDNstDkFgyqEhBHwtA";
+ String extraInfoDigestLine = String.format("extra-info-digest %s %s",
+ extraInfoDigest, additionalExtraInfoDigest);
+ ServerDescriptor descriptor = DescriptorBuilder.
+ createWithExtraInfoDigestLine(extraInfoDigestLine);
+ assertEquals(extraInfoDigest, descriptor.getExtraInfoDigest());
+ }
+
+ @Test()
public void testOnionKeyOpt() throws DescriptorParseException {
DescriptorBuilder.createWithOnionKeyLines("opt onion-key\n"
+ "-----BEGIN RSA PUBLIC KEY-----\n"
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits