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.
}
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) {