aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-01-07 17:49:13 +0000
committerNick Mathewson <nickm@torproject.org>2008-01-07 17:49:13 +0000
commita63eb68fe1546b7e1bebfa192b8ef0bdcc4c6980 (patch)
tree6cf2bc52becc935099d5ad4d3dfe559d6670ae5c /src
parentbecbafc9dba6c12c01fe1abdf5a1fb4d50e6aa15 (diff)
downloadtor-a63eb68fe1546b7e1bebfa192b8ef0bdcc4c6980.tar
tor-a63eb68fe1546b7e1bebfa192b8ef0bdcc4c6980.tar.gz
r17495@catbus: nickm | 2008-01-07 12:48:56 -0500
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:r13054
Diffstat (limited to 'src')
-rw-r--r--src/or/directory.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 18c66f52b..c4c491f43 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1280,7 +1280,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) {
routerstatus_t *rs;
trusted_dir_server_t *ds;
log_info(LD_DIR,"Received http status code %d (%s) from server "
@@ -1294,6 +1294,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);