From: Henrik Nordstrom Date: Fri, 11 Jul 2008 19:52:24 +0000 (+0200) Subject: Install the userhash and sourcehash keys X-Git-Tag: SQUID_3_1_0_1~49^2~145^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eec276474c42c5331bfe3670f452775ee9ede978;p=thirdparty%2Fsquid.git Install the userhash and sourcehash keys --- diff --git a/src/peer_sourcehash.cc b/src/peer_sourcehash.cc index ad66828fb0..d291e47dc0 100644 --- a/src/peer_sourcehash.cc +++ b/src/peer_sourcehash.cc @@ -2,9 +2,9 @@ /* * $Id: carp.cc,v 1.27 2008/01/14 12:13:49 hno Exp $ * - * DEBUG: section 39 Cache Array Routing Protocol + * DEBUG: section 39 Peer source hash based selection * AUTHOR: Henrik Nordstrom - * BASED ON: carp.c by Eric Stern and draft-vinod-carp-v1-03.txt + * BASED ON: carp.cc * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -168,11 +168,12 @@ carpSelectParent(HttpRequest * request) double score; double high_score = 0; const char *key = NULL; + char ntoabuf[MAX_IPSTRLEN]; if (n_carp_peers == 0) return NULL; - key = urlCanonical(request); + key = request->client_addr.NtoA(ntoabuf, sizeof(ntoabuf)); /* calculate hash key */ debugs(39, 2, "carpSelectParent: Calculating hash for " << key); diff --git a/src/peer_userhash.cc b/src/peer_userhash.cc index ad66828fb0..eb679fe5ba 100644 --- a/src/peer_userhash.cc +++ b/src/peer_userhash.cc @@ -2,9 +2,9 @@ /* * $Id: carp.cc,v 1.27 2008/01/14 12:13:49 hno Exp $ * - * DEBUG: section 39 Cache Array Routing Protocol + * DEBUG: section 39 Peer user hash based selection * AUTHOR: Henrik Nordstrom - * BASED ON: carp.c by Eric Stern and draft-vinod-carp-v1-03.txt + * BASED ON: carp.cc * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -172,7 +172,11 @@ carpSelectParent(HttpRequest * request) if (n_carp_peers == 0) return NULL; - key = urlCanonical(request); + if (request->auth_user_request) + key = request->auth_user_request->username(); + + if (!key) + return NULL; /* calculate hash key */ debugs(39, 2, "carpSelectParent: Calculating hash for " << key);