]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/adaptation/Service.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / adaptation / Service.cc
index 33b60a8b9f70c176d3bddb65a61006391e1d888d..0b2776fbf5844a8e260633207bfaa389ec38d90f 100644 (file)
@@ -1,7 +1,13 @@
 /*
- * DEBUG: section 93    Adaptation
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
+/* DEBUG: section 93    Adaptation */
+
 #include "squid.h"
 #include "adaptation/Service.h"
 #include "adaptation/ServiceFilter.h"
@@ -43,7 +49,7 @@ Adaptation::Service::wants(const ServiceFilter &filter) const
         // Sending a message to a service that does not want it is useless.
         // note that we cannot check wantsUrl for service that is not "up"
         // note that even essential services are skipped on unwanted URLs!
-        return wantsUrl(filter.request->urlpath);
+        return wantsUrl(filter.request->url.path());
     }
 
     // The service is down and is either not bypassable or not probed due
@@ -54,8 +60,8 @@ Adaptation::Service::wants(const ServiceFilter &filter) const
 Adaptation::Services &
 Adaptation::AllServices()
 {
-    static Services TheServices;
-    return TheServices;
+    static Services *TheServices = new Services;
+    return *TheServices;
 }
 
 Adaptation::ServicePointer
@@ -71,6 +77,9 @@ Adaptation::FindService(const Service::Id& key)
 
 void Adaptation::DetachServices()
 {
-    while (!AllServices().empty())
-        AllServices().pop_back()->detach();
+    while (!AllServices().empty()) {
+        AllServices().back()->detach();
+        AllServices().pop_back();
+    }
 }
+