]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix error in rev.13417 "ssl_bump none" mode crashes squid
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 5 Jun 2014 15:57:23 +0000 (08:57 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 5 Jun 2014 15:57:23 +0000 (08:57 -0700)
The fake CONNECT request generated to relay non-bumped traffic needs to
be pre-pended to any existing data in the ConnStateData::In buffer.
Otherwise our new bytes will corrupt any traffic bytes already in there
and our intended CONNECT request will never be recognised as we re-parse
the buffer.

src/client_side.cc

index cd7b74df6110fec8e369a8917700855165ff58a4..1e889e89e286d6c2c69b1ac0b1259cd457d05b79 100644 (file)
@@ -3620,8 +3620,9 @@ httpsSslBumpAccessCheckDone(allow_t answer, void *data)
         // fake a CONNECT request to force connState to tunnel
         static char ip[MAX_IPSTRLEN];
         connState->clientConnection->local.toUrl(ip, sizeof(ip));
-        // XXX need to *pre-pend* this fake request to the TLS bits already in the buffer
-        connState->in.buf.append("CONNECT ").append(ip).append(" HTTP/1.1\r\nHost: ").append(ip).append("\r\n\r\n");
+        // Pre-pend this fake request to the TLS bits already in the buffer
+        SBuf retStr("CONNECT ").append(ip).append(" HTTP/1.1\r\nHost: ").append(ip).append("\r\n\r\n");
+        connState->in.buf = retStr.append(connState->in.buf);
         bool ret = connState->handleReadData();
         if (ret)
             ret = connState->clientParseRequests();