From eec276474c42c5331bfe3670f452775ee9ede978 Mon Sep 17 00:00:00 2001 From: Henrik Nordstrom Date: Fri, 11 Jul 2008 21:52:24 +0200 Subject: [PATCH] Install the userhash and sourcehash keys --- src/peer_sourcehash.cc | 7 ++++--- src/peer_userhash.cc | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) 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); -- 2.47.2