[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [onionoo/master] Ensure that IPv6 hex characters are always lower-case.



commit 2324448000154571c60e768f28d910a98e45d973
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Dec 5 16:38:41 2012 +0100

    Ensure that IPv6 hex characters are always lower-case.
---
 src/org/torproject/onionoo/DetailDataWriter.java |   12 ++++++------
 src/org/torproject/onionoo/ResourceServlet.java  |    4 ++--
 web/index.html                                   |    4 ++++
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/org/torproject/onionoo/DetailDataWriter.java b/src/org/torproject/onionoo/DetailDataWriter.java
index af0a0b9..7d0ab15 100644
--- a/src/org/torproject/onionoo/DetailDataWriter.java
+++ b/src/org/torproject/onionoo/DetailDataWriter.java
@@ -569,8 +569,8 @@ public class DetailDataWriter {
       int addressesWritten = 0;
       for (String orAddress : orAddresses) {
         orAddressesAndPortsBuilder.append(
-            (addressesWritten++ > 0 ? "," : "") + "\"" + orAddress
-            + "\"");
+            (addressesWritten++ > 0 ? "," : "") + "\""
+            + orAddress.toLowerCase() + "\"");
       }
       String lastSeen = dateTimeFormat.format(entry.getLastSeenMillis());
       String firstSeen = dateTimeFormat.format(
@@ -699,8 +699,8 @@ public class DetailDataWriter {
         sb.append(",\n\"exit_addresses\":[");
         int written = 0;
         for (String exitAddress : entry.getExitAddresses()) {
-          sb.append((written++ > 0 ? "," : "") + "\"" + exitAddress
-              + "\"");
+          sb.append((written++ > 0 ? "," : "") + "\""
+              + exitAddress.toLowerCase() + "\"");
         }
         sb.append("]");
       }
@@ -838,8 +838,8 @@ public class DetailDataWriter {
       int addressesWritten = 0;
       for (String orAddress : orAddresses) {
         orAddressesAndPortsBuilder.append(
-            (addressesWritten++ > 0 ? "," : "") + "\"" + orAddress
-            + "\"");
+            (addressesWritten++ > 0 ? "," : "") + "\""
+            + orAddress.toLowerCase() + "\"");
       }
       StringBuilder sb = new StringBuilder();
       sb.append("{\"version\":1,\n"
diff --git a/src/org/torproject/onionoo/ResourceServlet.java b/src/org/torproject/onionoo/ResourceServlet.java
index 512b7ca..149f169 100644
--- a/src/org/torproject/onionoo/ResourceServlet.java
+++ b/src/org/torproject/onionoo/ResourceServlet.java
@@ -123,8 +123,8 @@ public class ResourceServlet extends HttpServlet {
     StringBuilder addressesBuilder = new StringBuilder();
     int written = 0;
     for (String address : addresses) {
-      addressesBuilder.append((written++ > 0 ? "," : "") + "\"" + address
-          + "\"");
+      addressesBuilder.append((written++ > 0 ? "," : "") + "\""
+          + address.toLowerCase() + "\"");
     }
     return String.format("{%s\"f\":\"%s\",\"a\":[%s],\"r\":%s}",
         (nickname == null ? "" : "\"n\":\"" + nickname + "\","),
diff --git a/web/index.html b/web/index.html
index ae084f1..1af4904 100755
--- a/web/index.html
+++ b/web/index.html
@@ -61,6 +61,7 @@ Required field.</li>
 <li><b>"a":</b> Array of IPv4 or IPv6 addresses where the relay accepts
 onion-routing connections or which the relay used to exit to the Internet
 in the past 24 hours.
+IPv6 hex characters are all lower-case.
 Required field.</li>
 <li><b>"r":</b> Boolean field saying whether this relay was listed as
 running in the last relay network status consensus.
@@ -113,9 +114,11 @@ hexadecimal characters.
 Required field.</li>
 <li><b>"or_addresses":</b> Array of IPv4 or IPv6 addresses and TCP ports
 or port lists where the relay accepts onion-routing connections.
+IPv6 hex characters are all lower-case.
 Required field.</li>
 <li><b>"exit_addresses":</b> Array of IPv4 or IPv6 addresses that the
 relay used to exit to the Internet in the past 24 hours.
+IPv6 hex characters are all lower-case.
 Only those addresses are listed that are different from onion-routing
 addresses.
 Optional field.
@@ -316,6 +319,7 @@ Required field.</li>
 <li><b>"or_addresses":</b> Array of sanitized IPv4 or IPv6 addresses and
 TCP ports or port lists where the bridge accepts onion-routing
 connections.
+IPv6 hex characters are all lower-case.
 Sanitized IP addresses are always in <i>10/8</i> or
 <i>[fd9f:2e19:3bcf/48]</i> IP networks and are only useful to learn which
 IP version the bridge uses and to detect whether the bridge changed its



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits