[tor-commits] [onionoo/master] Made the 'field' parameter case-insensitive, as specified by the protocol.

karsten at torproject.org karsten at torproject.org
Fri Dec 18 08:40:44 UTC 2015


commit 1974b5585a74e6f6a29c53ea6f62972c47f86fc1
Author: vi <vi at vikramverma.com>
Date:   Thu Dec 17 15:30:46 2015 +0000

    Made the 'field' parameter case-insensitive, as specified by the protocol.
    
    The protocol document states that field names are case-insensitive, but
    prior to this commit, the server implementation was non-compliant:
    
      % for field in as_number AS_Number; do
      %   curl -s "https://onionoo.torproject.org/details?limit=1&fields=$field"
      % done | jq .relays[]
      {
        "as_number": "AS24940"
      }
      {}
    
    This bug accidentally discovered during performance analysis, using
    <https://gist.github.com/fmap/6f44efe6f3ca3f79683b>.
---
 src/main/java/org/torproject/onionoo/server/ResourceServlet.java |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
index 1b6ad7f..9b19d44 100644
--- a/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
+++ b/src/main/java/org/torproject/onionoo/server/ResourceServlet.java
@@ -479,7 +479,7 @@ public class ResourceServlet extends HttpServlet {
       /* Fields contain illegal character(s). */
       return null;
     }
-    return parameter.split(",");
+    return parameter.toLowerCase().split(",");
   }
 }
 





More information about the tor-commits mailing list