Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/httpd rework the bindport setting, inspired by part ...
details: https://anonhg.NetBSD.org/src/rev/8086256a6230
branches: trunk
changeset: 1023102:8086256a6230
user: mrg <mrg%NetBSD.org@localhost>
date: Tue Aug 24 05:39:39 2021 +0000
description:
rework the bindport setting, inspired by part of the patch
from PR#56367 (thanks JP.)
diffstat:
libexec/httpd/bozohttpd.c | 23 +++++++----------------
1 files changed, 7 insertions(+), 16 deletions(-)
diffs (47 lines):
diff -r d9e1638bcdf3 -r 8086256a6230 libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Tue Aug 24 05:29:27 2021 +0000
+++ b/libexec/httpd/bozohttpd.c Tue Aug 24 05:39:39 2021 +0000
@@ -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 @@
* 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);
Home |
Main Index |
Thread Index |
Old Index