From: Alex Rousskov Date: Wed, 23 May 2012 23:23:12 +0000 (-0600) Subject: Fix protocol names in AnyP::PortCfg after http_port_list revamp in r12121. X-Git-Tag: BumpSslServerFirst.take08~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=119074777018c26f2466a63d4645f2206b69f8e8;p=thirdparty%2Fsquid.git Fix protocol names in AnyP::PortCfg after http_port_list revamp in r12121. 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. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 338583ffce..92b5c10f6b 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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) {