--- bozohttpd.c.orig 2020-08-20 09:57:01.000000000 +0200 +++ bozohttpd.c 2020-08-25 01:20:09.027722203 +0200 @@ -651,7 +651,17 @@ * if passed through a proxy that doesn't rewrite the port. */ if (httpd->bindport) { - if (strcmp(httpd->bindport, "80") != 0) + /* + * TODOleot: Test via CGI SERVER_PORT, IMHO it would be nice + * TODOleot: that it is always defined. + * TODOleot: Also double-check that `https' or `http' is + * TODOleot: valid according CGI standard. + */ + if (httpd->sslinfo ? + (strcmp(httpd->bindport, "https") != 0 || + strcmp(httpd->bindport, "443") != 0) : + (strcmp(httpd->bindport, "http") != 0 || + strcmp(httpd->bindport, "80") != 0)) port = httpd->bindport; else port = NULL; @@ -2212,8 +2222,10 @@ return code; } + const char *defport = httpd->sslinfo ? "443" : "80"; + if (request && request->hr_serverport && - strcmp(request->hr_serverport, "80") != 0) + strcmp(request->hr_serverport, defport) != 0) snprintf(portbuf, sizeof(portbuf), ":%s", request->hr_serverport); else --- daemon-bozo.c.orig 2019-01-17 08:46:16.000000000 +0100 +++ daemon-bozo.c 2020-08-25 01:16:55.436668662 +0200 @@ -131,7 +131,8 @@ if (!httpd->background) return; - portnum = (httpd->bindport) ? httpd->bindport : "http"; + portnum = (httpd->bindport) ? httpd->bindport : + (httpd->sslinfo) ? "https" : "http"; memset(&h, 0, sizeof(h)); h.ai_family = PF_UNSPEC; --- ssl-bozo.c.orig 2020-08-20 07:46:31.000000000 +0200 +++ ssl-bozo.c 2020-08-25 01:18:06.048804995 +0200 @@ -327,8 +327,6 @@ debug((httpd, DEBUG_NORMAL, "using cert/priv files: %s & %s", sslinfo->certificate_file, sslinfo->privatekey_file)); - if (!httpd->bindport) - httpd->bindport = bozostrdup(httpd, NULL, "https"); } void