[tor-bugs] #16151 [metrics-lib]: Add new descriptor source to fetch descriptors from CollecTor via https

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed May 27 17:13:36 UTC 2015


#16151: Add new descriptor source to fetch descriptors from CollecTor via https
-----------------------------+--------------------------
     Reporter:  karsten      |      Owner:  karsten
         Type:  enhancement  |     Status:  needs_review
     Priority:  normal       |  Milestone:
    Component:  metrics-lib  |    Version:
   Resolution:               |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+--------------------------

Comment (by iwakeh):

 Yeah, the changes look much cleaner now!


 Just one issue and one question about the test cases:

 The changes to the "remoteDirectories" array cannot be inferred from the
 interface-contract and could cause unwanted side effects for the caller of
 "collectRemoteFiles".

 Maybe, rather introduce a new method 'slashBeginAndEnd' (I cannot think of
 a better name):
 {{{
 private final static String SLASH = "/";
 private final static String EMPTY = "";

 public static String slashBeginAndEnd(String dir){
   return (dir.startsWith(SLASH) ? EMPTY : SLASH)  + dir
       + (dir.endsWith(SLASH) ? EMPTY : SLASH);
 }
 }}}

 remove lines 39-44, and change line 105 to
 {{{
 String directoryUrl = collecTorBaseUrl +
 slashBeginAndEnd(remoteDirectory);
 }}}

 Good to have the tests!
 What should happen if the same file is listed twice?
 And, a missmatch between directory date and file date?
 E.g. combined in one test string something like:
 {{{
 "<a href=\"2015-05-24-12-00-00-consensus\">"
         + "2015-05-24-12-00-00-consensus</a></td>"
         + "<td align=\"right\">27-May-2015 14:07   </td>"
         + "<a href=\"2015-05-24-12-00-00-consensus\">"
         + "2015-05-24-12-00-01-consensus</a></td>"
         + "<td align=\"right\">27-May-2015 14:19 </td>"
         + "<a href=\"2015-05-24-12-00-00-consensus\">"
         + "2015-05-24-12-00-00-consensus</a></td>"
         + "<td align=\"right\">26-May-2015 14:07   </td>"
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16151#comment:9>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list