[or-cvs] [metrics-web/master 4/5] Limit relay search to at most 1 month of data.

karsten at torproject.org karsten at torproject.org
Fri Dec 10 10:45:49 UTC 2010


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Fri, 10 Dec 2010 07:43:35 +0100
Subject: Limit relay search to at most 1 month of data.
Commit: 9fb9361db05864a45b76509bb3142fcbaf047596

---
 .../torproject/ernie/web/RelaySearchServlet.java   |    7 ++++---
 web/WEB-INF/relay-search.jsp                       |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/org/torproject/ernie/web/RelaySearchServlet.java b/src/org/torproject/ernie/web/RelaySearchServlet.java
index dc1ab01..01efc2e 100644
--- a/src/org/torproject/ernie/web/RelaySearchServlet.java
+++ b/src/org/torproject/ernie/web/RelaySearchServlet.java
@@ -238,9 +238,10 @@ public class RelaySearchServlet extends HttpServlet {
       searchFingerprintOrNickname.clear();
     }
 
-    /* We only accept at most three months or days, or people could
-     * accidentally keep the database busy. */
-    if (searchDays.size() + searchMonths.size() > 3) {
+    /* We only accept at most one month or three days, but not both, or
+     * people could accidentally keep the database busy. */
+    if (searchDays.size() > 3 || searchMonths.size() > 1 ||
+        (searchMonths.size() == 1 && searchDays.size() > 0)) {
       validQuery = false;
     }
 
diff --git a/web/WEB-INF/relay-search.jsp b/web/WEB-INF/relay-search.jsp
index ca78146..2108cfe 100644
--- a/web/WEB-INF/relay-search.jsp
+++ b/web/WEB-INF/relay-search.jsp
@@ -15,7 +15,7 @@
       <h2>Tor Metrics Portal: Relay Search</h2>
       <p>Search for a relay in the relay descriptor archive by typing
       (part of) a <b>nickname</b>, <b>fingerprint</b>, or <b>IP
-      address</b> and optionally up to three <b>months (yyyy-mm)</b> or
+      address</b> and optionally a <b>month (yyyy-mm)</b> or up to three
       <b>days (yyyy-mm-dd)</b> in the following search field and
       clicking Search. The search will stop after 30 hits or, unless you
       provide a month or a day, after parsing the last 30 days of relay
-- 
1.7.1




More information about the tor-commits mailing list