]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix protocol names in AnyP::PortCfg after http_port_list revamp in r12121.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 23 May 2012 23:23:12 +0000 (17:23 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 23 May 2012 23:23:12 +0000 (17:23 -0600)
The bug manifests itself when the URIs of intercepted requests are rewritten
into "https_port://..." strings, resulting in "Invalid port '0'" errors in
urlParse followed by HTTP 400 (Bad Request) rejection.

There are other, more subtle cases where wrong PortCfg protocol matters.

src/cache_cf.cc

index 338583ffce2a6e691c8aa9af77c94b780e6d874c..92b5c10f6bb68cd92d9e6b2e37df04a3a69c4bd6 100644 (file)
@@ -3777,8 +3777,19 @@ add_http_port(char *portspec)
 }
 
 static void
-parsePortCfg(AnyP::PortCfg ** head, const char *protocol)
-{
+parsePortCfg(AnyP::PortCfg ** head, const char *optionName)
+{
+    const char *protocol = NULL;
+    if (strcmp(optionName, "http_port") == 0 ||
+        strcmp(optionName, "ascii_port") == 0)
+        protocol = "http";
+    else if (strcmp(optionName, "https_port") == 0)
+        protocol = "https";
+    if (!protocol) {
+        self_destruct();
+        return;
+    }
+
     char *token = strtok(NULL, w_space);
 
     if (!token) {