summaryrefslogtreecommitdiff
path: root/libexec/httpd
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2021-08-24 05:39:39 +0000
committermrg <mrg@NetBSD.org>2021-08-24 05:39:39 +0000
commit95fa45fdb90af5908c4aed0d5ac02e2f064b0c69 (patch)
tree3e4ef5a0ad6c7fb678ac1b1f2cd72011ba471a80 /libexec/httpd
parente7f680d0a6d0a8c276c5172597523f29168383e0 (diff)
rework the bindport setting, inspired by part of the patch
from PR#56367 (thanks JP.)
Diffstat (limited to 'libexec/httpd')
-rw-r--r--libexec/httpd/bozohttpd.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c
index bf909f5837f..cec3240911b 100644
--- a/libexec/httpd/bozohttpd.c
+++ b/libexec/httpd/bozohttpd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bozohttpd.c,v 1.134 2021/08/24 05:29:27 mrg Exp $ */
+/* $NetBSD: bozohttpd.c,v 1.135 2021/08/24 05:39:39 mrg Exp $ */
/* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */
@@ -148,7 +148,7 @@
#include "bozohttpd.h"
#ifndef SSL_TIMEOUT
-#define SSL_TIMEOUT "30" /* wait for 30 seconds for ssl handshake */
+#define SSL_TIMEOUT "30" /* ssl handshake: 30 seconds timeout */
#endif
#ifndef INITIAL_TIMEOUT
#define INITIAL_TIMEOUT "30" /* wait for 30 seconds initially */
@@ -670,23 +670,14 @@ bozo_read_request(bozohttpd_t *httpd)
* Override the bound port from the request value, so it works even
* if passed through a proxy that doesn't rewrite the port.
*/
+ port = NULL;
if (httpd->bindport) {
if (strcmp(httpd->bindport, BOZO_HTTP_PORT) != 0)
port = httpd->bindport;
- else
- port = NULL;
- } else {
- if (getsockname(0, (struct sockaddr *)(void *)&ss, &slen) < 0)
- port = NULL;
- else {
- if (getnameinfo((struct sockaddr *)(void *)&ss, slen,
- NULL, 0, bufport, sizeof bufport,
- NI_NUMERICSERV) == 0)
- port = bufport;
- else
- port = NULL;
- }
- }
+ } else if (getsockname(0, (struct sockaddr *)(void *)&ss, &slen) == 0 &&
+ getnameinfo((struct sockaddr *)(void *)&ss, slen, NULL, 0,
+ bufport, sizeof bufport, NI_NUMERICSERV) == 0)
+ port = bufport;
if (port != NULL)
request->hr_serverport = bozostrdup(httpd, request, port);