[tor-commits] [tor/master] Make url-canonicalizer canonicalize correctly.

nickm at torproject.org nickm at torproject.org
Tue Sep 5 19:02:24 UTC 2017


commit 342712b9ef12c0234def9c2b4eb5c63f54c8bb5b
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Sep 5 15:02:16 2017 -0400

    Make url-canonicalizer canonicalize correctly.
---
 src/or/directory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/or/directory.c b/src/or/directory.c
index 5bf544e67..007235d10 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1971,7 +1971,9 @@ parse_http_url(const char *headers, char **url)
   }
   if (strcmpstart(*url, "/tor/")) {
     char *new_url = NULL;
-    tor_asprintf(&new_url, "/tor/%s", *url);
+    tor_asprintf(&new_url, "/tor%s%s",
+                 *url[0] == '/' ? "" : "/",
+                 *url);
     tor_free(*url);
     *url = new_url;
   }



More information about the tor-commits mailing list