diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-25 03:42:38 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-25 03:42:38 +0000 |
commit | 58ae3cd64831d64779afa4ef2291ad969059eb4b (patch) | |
tree | a32c32fd2b0d3fa264607c324491ed5bc96174ff /src/or/directory.c | |
parent | 3ab84c5f48231e8df2b27df97a8f342e526b0220 (diff) | |
download | tor-58ae3cd64831d64779afa4ef2291ad969059eb4b.tar.gz tor-58ae3cd64831d64779afa4ef2291ad969059eb4b.zip |
r11713@Kushana: nickm | 2006-12-24 22:42:08 -0500
Better handling of internal addresses wrt X-Your-Address-Is (never believe them; never provide them.) Also, report something useful for X-Your-Address-Is with one-hop tunneled connections.
svn:r9191
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 39f2407a9f..27b90fdac1 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1353,10 +1353,15 @@ write_http_response_header(dir_connection_t *conn, ssize_t length, format_rfc1123_time(date, now); cp = tmp; tor_snprintf(cp, sizeof(tmp), - "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Type: %s\r\n" - X_ADDRESS_HEADER "%s\r\n", - date, type, conn->_base.address); + "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Type: %s\r\n", + date, type); cp += strlen(tmp); + if (!is_internal_IP(conn->_base.addr, 0)) { + /* Don't report the source address for a localhost/private connection. */ + tor_snprintf(cp, sizeof(tmp)-(cp-tmp), + X_ADDRESS_HEADER "%s\r\n", conn->_base.address); + cp += strlen(cp); + } if (encoding) { tor_snprintf(cp, sizeof(tmp)-(cp-tmp), "Content-Encoding: %s\r\n", encoding); |