[tor-commits] [tor/master] Decorate addresses given to a HTTP CONNECT proxy.

nickm at torproject.org nickm at torproject.org
Thu Oct 11 02:32:44 UTC 2012


commit 41328c700992433fe3900fcbb78d62340ba197f2
Author: David Fifield <david at bamsoftware.com>
Date:   Sat Oct 6 20:40:18 2012 -0700

    Decorate addresses given to a HTTP CONNECT proxy.
    
    This affects the Request-URI and the value of the Host header. RFC 2616
    doesn't directly address the formatting of IPv6 addresses, but it
    delegates some productions to RFC 2396 "Uniform Resource Identifiers
    (URI): Generic Syntax," which is obsoleted by RFC 3986, which requires
    square brackets for IPv6 addresses in both places.
    
    I tested this with
    	HTTPSProxy 127.0.0.1:8000
    	Bridge <IPv6 bridge>
    	UseBridges 1
    and an Ncat HTTP proxy:
    	ncat --proxy-type http -l 8000 -vvv
    
    https://tools.ietf.org/html/rfc2616#section-3.2.1
    https://tools.ietf.org/html/rfc2616#section-5.1.2
    https://tools.ietf.org/html/rfc2616#section-14.23
    https://tools.ietf.org/html/rfc3986#section-3.2.2
---
 src/or/connection.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/or/connection.c b/src/or/connection.c
index 0cf375b..b5c4a20 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1512,7 +1512,7 @@ connection_proxy_connect(connection_t *conn, int type)
       }
 
       if (base64_authenticator) {
-        const char *addr = fmt_addr(&conn->addr);
+        const char *addr = fmt_and_decorate_addr(&conn->addr);
         tor_snprintf(buf, sizeof(buf), "CONNECT %s:%d HTTP/1.1\r\n"
                      "Host: %s:%d\r\n"
                      "Proxy-Authorization: Basic %s\r\n\r\n",
@@ -1522,7 +1522,7 @@ connection_proxy_connect(connection_t *conn, int type)
         tor_free(base64_authenticator);
       } else {
         tor_snprintf(buf, sizeof(buf), "CONNECT %s:%d HTTP/1.0\r\n\r\n",
-                     fmt_addr(&conn->addr), conn->port);
+                     fmt_and_decorate_addr(&conn->addr), conn->port);
       }
 
       connection_write_to_buf(buf, strlen(buf), conn);





More information about the tor-commits mailing list