From: Alex Rousskov Date: Wed, 23 May 2012 23:34:49 +0000 (-0600) Subject: Fix protocol names in AnyP::PortCfg after http_port_list revamp in r12121. X-Git-Tag: BumpSslServerFirst.take09~3^2~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3388e1f4ce681907d5eb9a00f91f0bba1aff55c;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 c1ca4767d9..1360decf90 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -3774,8 +3774,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) {