File SQUID_2016_9_port.patch of Package squid.1316

Index: squid-3.3.14/src/client_side_request.cc
===================================================================
--- squid-3.3.14.orig/src/client_side_request.cc
+++ squid-3.3.14/src/client_side_request.cc
@@ -190,12 +190,14 @@ ClientHttpRequest::ClientHttpRequest(Con
     setConn(aConn);
     al = new AccessLogEntry;
     al->tcpClient = clientConnection = aConn->clientConnection;
+    if (aConn) {
 #if USE_SSL
     if (aConn->clientConnection != NULL && aConn->clientConnection->isOpen()) {
         if (SSL *ssl = fd_table[aConn->clientConnection->fd].ssl)
             al->cache.sslClientCert.reset(SSL_get_peer_certificate(ssl));
     }
 #endif
+    }
     dlinkAdd(this, &active, &ClientActiveRequests);
 #if USE_ADAPTATION
     request_satisfaction_mode = false;
Index: squid-3.3.14/src/esi/Context.h
===================================================================
--- squid-3.3.14.orig/src/esi/Context.h
+++ squid-3.3.14/src/esi/Context.h
@@ -36,6 +36,7 @@
 #include "esi/Element.h"
 #include "clientStream.h"
 #include "err_type.h"
+#include "HttpReply.h"
 #include "HttpStatusCode.h"
 
 class ESIVarState;
@@ -116,7 +117,7 @@ public:
     err_type errorpage; /* if we error what page to use */
     http_status errorstatus; /* if we error, what code to return */
     char *errormessage; /* error to pass to error page */
-    HttpReply *rep; /* buffered until we pass data downstream */
+    HttpReply::Pointer rep; /* buffered until we pass data downstream */
     ESISegment::Pointer buffered; /* unprocessed data - for whatever reason */
     ESISegment::Pointer incoming;
     /* processed data we are waiting to send, or for
Index: squid-3.3.14/src/esi/Esi.cc
===================================================================
--- squid-3.3.14.orig/src/esi/Esi.cc
+++ squid-3.3.14/src/esi/Esi.cc
@@ -614,7 +614,7 @@ ESIContext::send ()
 
 #endif
 
-    if (!(rep || (outbound.getRaw() &&
+    if (!(rep != NULL || (outbound.getRaw() &&
                   outbound->len && (outbound_offset <= outbound->len)))) {
         debugs(86, 5, "ESIContext::send: Nothing to send.");
         return 0;
@@ -659,18 +659,18 @@ ESIContext::send ()
     flags.clientwantsdata = 0;
     debugs(86, 5, "ESIContext::send: this=" << this << " Client no longer wants data ");
     /* Deal with re-entrancy */
-    HttpReply *temprep = rep;
+    HttpReply::Pointer temprep = rep;
     rep = NULL; /* freed downstream */
 
-    if (temprep && varState)
-        varState->buildVary (temprep);
+    if (temprep != NULL && varState)
+        varState->buildVary (temprep.raw());
 
     {
         StoreIOBuffer tempBuffer;
         tempBuffer.length = len;
         tempBuffer.offset = pos - len;
         tempBuffer.data = next->readBuffer.data;
-        clientStreamCallback (thisNode, http, temprep, tempBuffer);
+        clientStreamCallback (thisNode, http, temprep.raw(), tempBuffer);
     }
 
     if (len == 0)
@@ -1300,7 +1300,7 @@ ESIContext::parse()
         ++parserState.stackdepth;
     }
 
-    if (rep && !parserState.inited())
+    if (rep != NULL && !parserState.inited())
         parserState.init(this);
 
     /* we have data */
@@ -1439,7 +1439,7 @@ ESIContext::freeResources ()
 {
     debugs(86, 5, HERE << "Freeing for this=" << this);
 
-    HTTPMSGUNLOCK(rep);
+    rep = NULL; // ref counted
 
     finishChildren ();
 
openSUSE Build Service is sponsored by