The unified diff between revisions [4d68673c..] and [29abc3f7..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "src/client_side.c"
#  from [aeb1c49f1a704cceb4928f31ac6df0b91c200cad]
#    to [4b258b7a5b5bedb849df5fd524f799b736235972]
#
# patch "src/forward.c"
#  from [bde01cf37e23444aea4910eed79e76d3371277fb]
#    to [0cd445517e0ef996cf13bf0240590d59f635a1ac]
#
# patch "src/http.c"
#  from [69d4e2cd7969e575f5cdba81916aab1f9b2c6223]
#    to [88bffb5cf44e30acc04d196f97cf31496043f0ac]
#
# patch "src/structs.h"
#  from [8c514b042f35f6fd32b0a73cf21a9643cf2d6cd4]
#    to [0100561257b682f546876e0c6de048c4e1100b38]
#
============================================================
--- src/client_side.c	aeb1c49f1a704cceb4928f31ac6df0b91c200cad
+++ src/client_side.c	4b258b7a5b5bedb849df5fd524f799b736235972
@@ -1033,8 +1033,13 @@ clientInterpretRequestHeaders(clientHttp
 	if (request->range)
 	    request->flags.range = 1;
     }
-    if ((httpHeaderHas(req_hdr, HDR_AUTHORIZATION)) || (request->flags.pinned))
+    if(http->conn->pinned) {
 	request->flags.auth = 1;
+	request->flags.pinned = 1;
+	request->flags.must_keepalive = 1;
+    }
+    if (httpHeaderHas(req_hdr, HDR_AUTHORIZATION))
+	request->flags.auth = 1;
     if (request->login[0] != '\0')
 	request->flags.auth = 1;
     if (httpHeaderHas(req_hdr, HDR_VIA)) {
@@ -1445,8 +1450,9 @@ clientBuildReplyHeader(clientHttpRequest
 		    (strncasecmp(value, "Negotiate", 9) == 0 &&
 			(value[9] == '\0' || value[9] == ' '))) {
 		    httpHeaderPutStr(hdr, HDR_PROXY_SUPPORT, "Session-Based-Authentication");
-		    httpHeaderPutStr(hdr, HDR_CONNECTION, "Proxy-support");
 		    request->flags.pinned=1;
+		    request->flags.must_keepalive = 1;
+		    http->conn->pinned=1;
 		    break;
 		}
 	    }
============================================================
--- src/forward.c	bde01cf37e23444aea4910eed79e76d3371277fb
+++ src/forward.c	0cd445517e0ef996cf13bf0240590d59f635a1ac
@@ -150,14 +150,17 @@ fwdCheckRetry(FwdState * fwdState)
 	return 0;
     if (fwdState->request->flags.body_sent)
 	return 0;
-    if (fwdState->request->flags.pinned)
-	return 0;
     return 1;
 }

 static int
 fwdCheckRetriable(FwdState * fwdState)
 {
+    /* If the conneciton is pinned, we want to allow the re-use of this fd
+       regardless of method */
+    if (fwdState->request->flags.pinned)
+	return 1;
+
     /* If there is a request body then Squid can only try once
      * even if the method is indempotent
      */
============================================================
--- src/http.c	69d4e2cd7969e575f5cdba81916aab1f9b2c6223
+++ src/http.c	88bffb5cf44e30acc04d196f97cf31496043f0ac
@@ -581,16 +581,6 @@ httpReadReply(int fd, void *data)
     else
 	delay_id = delayMostBytesAllowed(entry->mem_obj, &read_sz);
 #endif
-    if ( httpState->request->flags.pinned ) {
-	client_addr=&httpState->request->client_addr;
-	client_port=httpState->request->client_port;
-    }
-#if LINUX_TPROXY
-    else if ( ( Config.onoff.linux_tproxy ) &&
-      ( (httpState->request->my_port == Config.tproxy_port) || (Config.tproxy_port == 0) )) {
-        client_addr=&httpState->request->client_addr;
-    }
-#endif

     errno = 0;
     statCounter.syscalls.sock.reads++;
@@ -742,6 +732,16 @@ httpReadReply(int fd, void *data)
 		    }
 		}
 		if (keep_alive) {
+		    if ( httpState->request->flags.pinned ) {
+			client_addr=&httpState->request->client_addr;
+			client_port=httpState->request->client_port;
+		    }
+#if LINUX_TPROXY
+		    else if ( ( Config.onoff.linux_tproxy ) &&
+		      ( (httpState->request->my_port == Config.tproxy_port) || (Config.tproxy_port == 0) )) {
+			client_addr=&httpState->request->client_addr;
+		    }
+#endif
 		    /* yes we have to clear all these! */
 		    commSetDefer(fd, NULL, NULL);
 		    commSetTimeout(fd, -1, NULL, NULL);
============================================================
--- src/structs.h	8c514b042f35f6fd32b0a73cf21a9643cf2d6cd4
+++ src/structs.h	0100561257b682f546876e0c6de048c4e1100b38
@@ -1164,6 +1164,7 @@ struct _ConnStateData {
     struct in_addr log_addr;
     char rfc931[USER_IDENT_SZ];
     int nrequests;
+    int pinned;		/* Is this connection pinned */
     struct {
 	int n;
 	time_t until;