]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Allow uri=value parameter when specifying adaptation service URIs.
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 16 Dec 2010 06:12:06 +0000 (23:12 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 16 Dec 2010 06:12:06 +0000 (23:12 -0700)
When adaptation service URI contains a "=" character, Squid thinks you are
specifying a name=value option rather than a service URI. This leads to a
fatal configuration error.

This change lets you specify the service URI using the uri=value
syntax where the value may contain "=" character(s). For example, the
following works after and only after this change:

  icap_service s1 reqmod_precache uri=icap://10.0.0.1:1344/adapt?bar=foo

TODO: Should the adaptation service parser be changed to treat the last word
on the icap_service line as a service URI, regardless of whether it contains
the "=" character?

src/adaptation/ServiceConfig.cc

index 9751422f056f38fa5d2bf9028dc0c9e2eff9df15..cb39b99c6d8a182cac397e80ebc8dcdd8a6cca75 100644 (file)
@@ -69,6 +69,7 @@ Adaptation::ServiceConfig::parse()
 
     // handle optional service name=value parameters
     const char *lastOption = NULL;
+    bool grokkedUri = false;
     while (char *option = strtok(NULL, w_space)) {
         if (strcmp(option, "0") == 0) { // backward compatibility
             bypass = false;
@@ -94,6 +95,8 @@ Adaptation::ServiceConfig::parse()
             grokked = grokBool(bypass, name, value);
         else if (strcmp(name, "routing") == 0)
             grokked = grokBool(routing, name, value);
+        else if (strcmp(name, "uri") == 0)
+            grokked = grokkedUri = grokUri(value);
         else if (strcmp(name, "ipv6") == 0) {
             grokked = grokBool(ipv6, name, value);
             if (grokked && ipv6 && !Ip::EnableIpv6)
@@ -107,7 +110,7 @@ Adaptation::ServiceConfig::parse()
     }
 
     // what is left must be the service URI
-    if (!grokUri(lastOption))
+    if (!grokkedUri && !grokUri(lastOption))
         return false;
 
     // there should be nothing else left