]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add stream isolation support for HTTP CONNECT tunnels
authorNick Mathewson <nickm@torproject.org>
Sun, 20 Aug 2017 16:35:26 +0000 (12:35 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 5 Sep 2017 18:34:09 +0000 (14:34 -0400)
I'm doing this using the Proxy-Authorization: header to support
clients that understand it, and with a new tor-specific header that
makes more sense for our use.

src/or/connection_edge.c

index 98522218b15cbbab015dea805cb644d1dc6d9aee..8d2b562d89c2312291274b347d2c5ae0f80c1ab2 100644 (file)
@@ -2412,7 +2412,20 @@ connection_ap_process_http_connect(entry_connection_t *conn)
     goto err;
   }
 
-  /* XXXX Look at headers */
+  /* Abuse the 'username' and 'password' fields here. They are already an
+  * abuse. */
+  {
+    char *authorization = http_get_header(headers, "Proxy-Authorization: ");
+    if (authorization) {
+      socks->username = authorization; // steal reference
+      socks->usernamelen = strlen(authorization);
+    }
+    char *isolation = http_get_header(headers, "X-Tor-Stream-Isolation: ");
+    if (isolation) {
+      socks->password = isolation; // steal reference
+      socks->passwordlen = strlen(isolation);
+    }
+  }
 
   socks->command = SOCKS_COMMAND_CONNECT;
   socks->listener_type = CONN_TYPE_AP_HTTP_CONNECT_LISTENER;