commit a80dc1252344b83271d0a03d31ad24e0ee67268f Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Dec 5 19:36:42 2012 +0100
Actually support searching for hashed full fingerprints.
The spec says that we support looking up and searching for hashed full fingerprints, but only the former was implemented. Implement the latter, too. --- src/org/torproject/onionoo/ResourceServlet.java | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/onionoo/ResourceServlet.java b/src/org/torproject/onionoo/ResourceServlet.java index 149f169..9a2e353 100644 --- a/src/org/torproject/onionoo/ResourceServlet.java +++ b/src/org/torproject/onionoo/ResourceServlet.java @@ -428,7 +428,15 @@ public class ResourceServlet extends HttpServlet { private void filterBySearchTerms(Map<String, String> filteredRelays, Map<String, String> filteredBridges, String[] searchTerms) { for (String searchTerm : searchTerms) { - filterBySearchTerm(filteredRelays, filteredBridges, searchTerm); + if (searchTerm.startsWith("$") && searchTerm.length() == 41) { + this.filterByFingerprint(filteredRelays, filteredBridges, + searchTerm.substring(1).toUpperCase()); + } else if (!searchTerm.startsWith("$") && searchTerm.length() == 40) { + this.filterByFingerprint(filteredRelays, filteredBridges, + searchTerm.toUpperCase()); + } else { + filterBySearchTerm(filteredRelays, filteredBridges, searchTerm); + } } }
tor-commits@lists.torproject.org