]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/carp.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / carp.cc
index 957ddc47edf483e8fd9da0a8068105722deab19a..0361195ddfa8d5b63f475ef75dc7824c24a49959 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -13,9 +13,9 @@
 #include "HttpRequest.h"
 #include "mgr/Registration.h"
 #include "neighbors.h"
+#include "PeerSelectState.h"
 #include "SquidConfig.h"
 #include "Store.h"
-#include "URL.h"
 
 #include <cmath>
 
@@ -143,8 +143,11 @@ carpInit(void)
 }
 
 CachePeer *
-carpSelectParent(HttpRequest * request)
+carpSelectParent(PeerSelector *ps)
 {
+    assert(ps);
+    HttpRequest *request = ps->request;
+
     int k;
     CachePeer *p = NULL;
     CachePeer *tp;
@@ -167,7 +170,7 @@ carpSelectParent(HttpRequest * request)
             // this code follows URI syntax pattern.
             // corner cases should use the full effective request URI
             if (tp->options.carp_key.scheme) {
-                key.append(request->url.getScheme().c_str());
+                key.append(request->url.getScheme().image());
                 if (key.length()) //if the scheme is not empty
                     key.append("://");
             }
@@ -204,7 +207,7 @@ carpSelectParent(HttpRequest * request)
         debugs(39, 3, "carpSelectParent: key=" << key << " name=" << tp->name << " combined_hash=" << combined_hash  <<
                " score=" << std::setprecision(0) << score);
 
-        if ((score > high_score) && peerHTTPOkay(tp, request)) {
+        if ((score > high_score) && peerHTTPOkay(tp, ps)) {
             p = tp;
             high_score = score;
         }