[tor-commits] [tor/maint-0.2.2] Remove workaround code for bug539

nickm at torproject.org nickm at torproject.org
Thu Apr 7 16:04:47 UTC 2011


commit 550749555cd57a1f82fe6c08e866ae14456ed439
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Mar 25 17:11:04 2011 -0400

    Remove workaround code for bug539
    
    We fixed bug 539 (where directories would say "503" but send data
    anyway) back in 0.2.0.16-alpha/0.1.2.19.  Because most directory
    versions were affected, we added workaround to make sure that we
    examined the contents of 503-replies to make sure there wasn't any
    data for them to find.  But now that such routers are nonexistent,
    we can remove this code.  (Even if somebody fired up an 0.1.2.19
    directory cache today, it would still be fine to ignore data in its
    erroneous 503 replies.)
---
 changes/bug539_removal |    6 ++++++
 src/or/directory.c     |   33 +++++++++++++--------------------
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/changes/bug539_removal b/changes/bug539_removal
new file mode 100644
index 0000000..dbff43d
--- /dev/null
+++ b/changes/bug539_removal
@@ -0,0 +1,6 @@
+  o Removed code
+    - Removed workaround code to handle directory responses from
+      servers that had bug 539 (they would send HTTP status 503
+      responses _and_ send a body too).  Since only server versions
+      before 0.2.0.16-alpha/0.1.2.19 were affected, there is no longer
+      reason to keep the workaround in place.
diff --git a/src/or/directory.c b/src/or/directory.c
index 1347c8b..8f33a60 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1539,26 +1539,19 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
   (void) skewed; /* skewed isn't used yet. */
 
   if (status_code == 503) {
-    if (body_len < 16) {
-      routerstatus_t *rs;
-      trusted_dir_server_t *ds;
-      log_info(LD_DIR,"Received http status code %d (%s) from server "
-               "'%s:%d'. I'll try again soon.",
-               status_code, escaped(reason), conn->_base.address,
-               conn->_base.port);
-      if ((rs = router_get_consensus_status_by_id(conn->identity_digest)))
-        rs->last_dir_503_at = now;
-      if ((ds = router_get_trusteddirserver_by_digest(conn->identity_digest)))
-        ds->fake_status.last_dir_503_at = now;
+    routerstatus_t *rs;
+    trusted_dir_server_t *ds;
+    log_info(LD_DIR,"Received http status code %d (%s) from server "
+             "'%s:%d'. I'll try again soon.",
+             status_code, escaped(reason), conn->_base.address,
+             conn->_base.port);
+    if ((rs = router_get_consensus_status_by_id(conn->identity_digest)))
+      rs->last_dir_503_at = now;
+    if ((ds = router_get_trusteddirserver_by_digest(conn->identity_digest)))
+      ds->fake_status.last_dir_503_at = now;
 
-      tor_free(body); tor_free(headers); tor_free(reason);
-      return -1;
-    }
-    /* XXXX022 Remove this once every server with bug 539 is obsolete. */
-    log_info(LD_DIR, "Server at '%s:%d' sent us a 503 response, but included "
-             "a body anyway.  We'll pretend it gave us a 200.",
-             conn->_base.address, conn->_base.port);
-    status_code = 200;
+    tor_free(body); tor_free(headers); tor_free(reason);
+    return -1;
   }
 
   plausible = body_is_plausible(body, body_len, conn->_base.purpose);





More information about the tor-commits mailing list