Blame SOURCES/squid-3.5.20-https-packet-size.patch

e6ac7e
diff --git a/src/client_side.cc b/src/client_side.cc
e6ac7e
index 79b1b4b..01760f3 100644
e6ac7e
--- a/src/client_side.cc
e6ac7e
+++ b/src/client_side.cc
e6ac7e
@@ -4369,7 +4369,7 @@ void httpsSslBumpStep2AccessCheckDone(allow_t answer, void *data)
e6ac7e
             connState->in.buf.append(rbuf.content(), rbuf.contentSize());
e6ac7e
             ClientSocketContext::Pointer context = connState->getCurrentContext();
e6ac7e
             ClientHttpRequest *http = context->http;
e6ac7e
-            tunnelStart(http, &http->out.size, &http->al->http.code, http->al);
e6ac7e
+            tunnelStart(http);
e6ac7e
         }
e6ac7e
     }
e6ac7e
 }
e6ac7e
diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc
e6ac7e
index d17cfec..84447d1 100644
e6ac7e
--- a/src/client_side_reply.cc
e6ac7e
+++ b/src/client_side_reply.cc
e6ac7e
@@ -1114,7 +1114,7 @@ clientReplyContext::storeNotOKTransferDone() const
e6ac7e
     if (curReply->content_length < 0)
e6ac7e
         return 0;
e6ac7e
 
e6ac7e
-    int64_t expectedLength = curReply->content_length + http->out.headers_sz;
e6ac7e
+    uint64_t expectedLength = curReply->content_length + http->out.headers_sz;
e6ac7e
 
e6ac7e
     if (http->out.size < expectedLength)
e6ac7e
         return 0;
e6ac7e
diff --git a/src/client_side_request.cc b/src/client_side_request.cc
e6ac7e
index 05de6da..a824b08 100644
e6ac7e
--- a/src/client_side_request.cc
e6ac7e
+++ b/src/client_side_request.cc
e6ac7e
@@ -1501,7 +1501,7 @@ ClientHttpRequest::processRequest()
e6ac7e
         }
e6ac7e
 #endif
e6ac7e
         getConn()->stopReading(); // tunnels read for themselves
e6ac7e
-        tunnelStart(this, &out.size, &al->http.code, al);
e6ac7e
+        tunnelStart(this);
e6ac7e
         return;
e6ac7e
     }
e6ac7e
 
e6ac7e
diff --git a/src/client_side_request.h b/src/client_side_request.h
e6ac7e
index 442d362..51a6d75 100644
e6ac7e
--- a/src/client_side_request.h
e6ac7e
+++ b/src/client_side_request.h
e6ac7e
@@ -73,7 +73,7 @@ public:
e6ac7e
 
e6ac7e
     struct {
e6ac7e
         int64_t offset;
e6ac7e
-        int64_t size;
e6ac7e
+        uint64_t size;
e6ac7e
         size_t headers_sz;
e6ac7e
     } out;
e6ac7e
 
e6ac7e
@@ -180,7 +180,7 @@ int clientHttpRequestStatus(int fd, ClientHttpRequest const *http);
e6ac7e
 void clientAccessCheck(ClientHttpRequest *);
e6ac7e
 
e6ac7e
 /* ones that should be elsewhere */
e6ac7e
-void tunnelStart(ClientHttpRequest *, int64_t *, int *, const AccessLogEntry::Pointer &al);
e6ac7e
+void tunnelStart(ClientHttpRequest *);
e6ac7e
 
e6ac7e
 #if _USE_INLINE_
e6ac7e
 #include "client_side_request.cci"
e6ac7e
diff --git a/src/tests/stub_tunnel.cc b/src/tests/stub_tunnel.cc
e6ac7e
index 822b8c8..6a57dfb 100644
e6ac7e
--- a/src/tests/stub_tunnel.cc
e6ac7e
+++ b/src/tests/stub_tunnel.cc
e6ac7e
@@ -14,7 +14,7 @@
e6ac7e
 #include "FwdState.h"
e6ac7e
 class ClientHttpRequest;
e6ac7e
 
e6ac7e
-void tunnelStart(ClientHttpRequest *, int64_t *, int *, const AccessLogEntryPointer &al) STUB
e6ac7e
+void tunnelStart(ClientHttpRequest *) STUB
e6ac7e
 
e6ac7e
 void switchToTunnel(HttpRequest *request, Comm::ConnectionPointer &clientConn, Comm::ConnectionPointer &srvConn) STUB
e6ac7e
 
e6ac7e
diff --git a/src/tunnel.cc b/src/tunnel.cc
e6ac7e
index 1d4bed7..d595150 100644
e6ac7e
--- a/src/tunnel.cc
e6ac7e
+++ b/src/tunnel.cc
e6ac7e
@@ -139,7 +139,7 @@ public:
e6ac7e
         int len;
e6ac7e
         char *buf;
e6ac7e
         AsyncCall::Pointer writer; ///< pending Comm::Write callback
e6ac7e
-        int64_t *size_ptr;      /* pointer to size in an ConnStateData for logging */
e6ac7e
+        uint64_t *size_ptr;      /* pointer to size in an ConnStateData for logging */
e6ac7e
 
e6ac7e
         Comm::ConnectionPointer conn;    ///< The currently connected connection.
e6ac7e
         uint8_t delayedLoops; ///< how many times a read on this connection has been postponed.
e6ac7e
@@ -849,6 +849,11 @@ tunnelConnectedWriteDone(const Comm::ConnectionPointer &conn, char *buf, size_t
e6ac7e
         return;
e6ac7e
     }
e6ac7e
 
e6ac7e
+    if (ClientHttpRequest *http = tunnelState->http.get()) {
e6ac7e
+        http->out.headers_sz += size;
e6ac7e
+        http->out.size += size;
e6ac7e
+    }
e6ac7e
+
e6ac7e
     tunnelStartShoveling(tunnelState);
e6ac7e
 }
e6ac7e
 
e6ac7e
@@ -996,7 +1001,7 @@ tunnelConnectDone(const Comm::ConnectionPointer &conn, Comm::Flag status, int xe
e6ac7e
 }
e6ac7e
 
e6ac7e
 void
e6ac7e
-tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr, const AccessLogEntryPointer &al)
e6ac7e
+tunnelStart(ClientHttpRequest * http)
e6ac7e
 {
e6ac7e
     debugs(26, 3, HERE);
e6ac7e
     /* Create state structure. */
e6ac7e
@@ -1022,7 +1027,7 @@ tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr, const
e6ac7e
         if (ch.fastCheck() == ACCESS_DENIED) {
e6ac7e
             debugs(26, 4, HERE << "MISS access forbidden.");
e6ac7e
             err = new ErrorState(ERR_FORWARDING_DENIED, Http::scForbidden, request);
e6ac7e
-            *status_ptr = Http::scForbidden;
e6ac7e
+            http->al->http.code = Http::scForbidden;
e6ac7e
             errorSend(http->getConn()->clientConnection, err);
e6ac7e
             return;
e6ac7e
         }
e6ac7e
@@ -1038,12 +1043,13 @@ tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr, const
e6ac7e
 #endif
e6ac7e
     tunnelState->url = xstrdup(url);
e6ac7e
     tunnelState->request = request;
e6ac7e
-    tunnelState->server.size_ptr = size_ptr;
e6ac7e
-    tunnelState->status_ptr = status_ptr;
e6ac7e
+    tunnelState->server.size_ptr = &http->out.size;
e6ac7e
+    tunnelState->client.size_ptr = &http->al->http.clientRequestSz.payloadData;
e6ac7e
+    tunnelState->status_ptr = &http->al->http.code;
e6ac7e
     tunnelState->logTag_ptr = &http->logType;
e6ac7e
     tunnelState->client.conn = http->getConn()->clientConnection;
e6ac7e
     tunnelState->http = http;
e6ac7e
-    tunnelState->al = al;
e6ac7e
+    tunnelState->al = http->al ;
e6ac7e
     tunnelState->started = squid_curtime;
e6ac7e
 
e6ac7e
     comm_add_close_handler(tunnelState->client.conn->fd,
e6ac7e
@@ -1054,7 +1060,7 @@ tunnelStart(ClientHttpRequest * http, int64_t * size_ptr, int *status_ptr, const
e6ac7e
                                      CommTimeoutCbPtrFun(tunnelTimeout, tunnelState));
e6ac7e
     commSetConnTimeout(tunnelState->client.conn, Config.Timeout.lifetime, timeoutCall);
e6ac7e
 
e6ac7e
-    peerSelect(&(tunnelState->serverDestinations), request, al,
e6ac7e
+    peerSelect(&(tunnelState->serverDestinations), request, tunnelState->al,
e6ac7e
                NULL,
e6ac7e
                tunnelPeerSelectComplete,
e6ac7e
                tunnelState);
e6ac7e
@@ -1227,6 +1233,10 @@ switchToTunnel(HttpRequest *request, Comm::ConnectionPointer &clientConn, Comm::
e6ac7e
         if (context != NULL && context->http != NULL) {
e6ac7e
             tunnelState->logTag_ptr = &context->http->logType;
e6ac7e
             tunnelState->server.size_ptr = &context->http->out.size;
e6ac7e
+            if (context->http->al != NULL) {
e6ac7e
+                tunnelState->al = context->http->al;
e6ac7e
+                tunnelState->client.size_ptr = &context->http->al->http.clientRequestSz.payloadData;
e6ac7e
+            }
e6ac7e
 
e6ac7e
 #if USE_DELAY_POOLS
e6ac7e
             /* no point using the delayIsNoDelay stuff since tunnel is nice and simple */