diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-01-07 17:49:22 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-01-07 17:49:22 +0000 |
commit | ad7837d925d2e9d3752c3860f7b41e63df31884d (patch) | |
tree | 212edd2504df2da5eeb693c2104e655b0fd9b73b | |
parent | 83ac50c2b2ac0e6cf709e19d4e23b1875f73b7f6 (diff) | |
download | tor-ad7837d925d2e9d3752c3860f7b41e63df31884d.tar.gz tor-ad7837d925d2e9d3752c3860f7b41e63df31884d.zip |
r17496@catbus: nickm | 2008-01-07 12:49:06 -0500
Backport: Consequence of fix for 539: when a client gets a 503 response with a nontrivial body, pretend it got a 200 response. This lets clients use information erroneously sent to them by old buggy servers.
svn:r13055
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/or/directory.c | 8 |
2 files changed, 11 insertions, 1 deletions
@@ -35,6 +35,10 @@ Changes in version 0.1.2.19 - 2008-01-?? directory caches, and then we learned about a new descriptor for that router, we weren't resetting our failure count. Reported by lodger. + - Although we fixed bug 539 (where servers would send HTTP status 503 + responses _and_ send a body too), there are still servers out there + that haven't upgraded. Therefore, make clients parse such bodies + when they receive them. Changes in version 0.1.2.18 - 2007-10-28 diff --git a/src/or/directory.c b/src/or/directory.c index 792a847c22..d447925c7e 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -932,7 +932,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) } (void) skewed; /* skewed isn't used yet. */ - if (status_code == 503) { + if (status_code == 503 && body_len < 16) { local_routerstatus_t *rs; trusted_dir_server_t *ds; time_t now = time(NULL); @@ -947,6 +947,12 @@ connection_dir_client_reached_eof(dir_connection_t *conn) tor_free(body); tor_free(headers); tor_free(reason); return -1; + } else if (status_code == 503) { + /* 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; } plausible = body_is_plausible(body, body_len, conn->_base.purpose); |