The unified diff between revisions [a8f17161..] and [4d68673c..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/http.c'
#
#
# patch "src/http.c"
# from [b0bbfbeb452d1642a4dc436c4c59565fd7a66354]
# to [69d4e2cd7969e575f5cdba81916aab1f9b2c6223]
#
============================================================
--- src/http.c b0bbfbeb452d1642a4dc436c4c59565fd7a66354
+++ src/http.c 69d4e2cd7969e575f5cdba81916aab1f9b2c6223
@@ -550,30 +550,6 @@ httpPconnTransferDone(HttpStateData * ht
return 1;
}
-/* Small helper function to verify if connection pinning is supported or not
- */
-static int
-peer_supports_connection_pinning(HttpStateData *httpState)
-{
- const HttpReply *rep = httpState->entry->mem_obj->reply;
- const HttpHeader *hdr = &rep->header;
- int rc;
- String header;
-
- if (!httpState->peer)
- return 1;
-
- if (!httpHeaderHas(hdr, HDR_PROXY_SUPPORT))
- return 0;
-
- header = httpHeaderGetStrOrList(hdr, HDR_PROXY_SUPPORT);
- /* XXX This ought to be done in a case-insensitive manner */
- rc = (strStr(header, "Session-Based-Authentication") != NULL);
- stringClean(&header);
-
- return rc;
-}
-
/* This will be called when data is ready to be read from fd. Read until
* error or connection closed. */
/* XXX this function is too long! */
@@ -588,7 +564,8 @@ httpReadReply(int fd, void *data)
int bin;
int clen;
size_t read_sz = SQUID_TCP_SO_RCVBUF;
- struct in_addr *local=NULL;
+ struct in_addr *client_addr=NULL;
+ u_short client_port=0;
#if DELAY_POOLS
delay_id delay_id;
#endif
@@ -604,10 +581,15 @@ 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
- if ( Config.onoff.linux_tproxy )
- local=&httpState->request->client_addr;
+ 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;
@@ -769,12 +751,10 @@ httpReadReply(int fd, void *data)
#endif
comm_remove_close_handler(fd, httpStateFree, httpState);
fwdUnregister(fd, httpState->fwd);
- if (request->pinned_connection && peer_supports_connection_pinning(httpState))
- clientPinConnection(request->pinned_connection, request->host, request->port, fd);
- else if (request->flags.accelerated && Config.Accel.single_host && Config.Accel.host)
- pconnPush(fd, Config.Accel.host, Config.Accel.port, local);
+ if (request->flags.accelerated && Config.Accel.single_host && Config.Accel.host)
+ pconnPush(fd, Config.Accel.host, Config.Accel.port, client_addr, client_port);
else
- pconnPush(fd, request->host, request->port, local);
+ pconnPush(fd, request->host, request->port, client_addr, client_port);
fwdComplete(httpState->fwd);
httpState->fd = -1;
httpStateFree(fd, httpState);