summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/parse.y
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-01-06 14:07:49 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-01-06 14:07:49 +0000
commita49ec1f9984778391e992b167d108a5e6b632758 (patch)
tree44a4148f741b6f93a0ddbcd73aa6359cb164b703 /usr.sbin/httpd/parse.y
parent96deda13656045b8525045fe114105ab73f04f87 (diff)
Only open a socket once for each unique "listen on" statement. This
prevents running out of file descriptors when loading a configuration with many aliases. OK florian@
Diffstat (limited to 'usr.sbin/httpd/parse.y')
-rw-r--r--usr.sbin/httpd/parse.y7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y
index 5a9616c88dc..c7a536c967c 100644
--- a/usr.sbin/httpd/parse.y
+++ b/usr.sbin/httpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.50 2015/01/04 22:23:58 chrisz Exp $ */
+/* $OpenBSD: parse.y,v 1.51 2015/01/06 14:07:48 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -226,6 +226,7 @@ server : SERVER STRING {
strlcpy(s->srv_conf.errorlog, HTTPD_ERROR_LOG,
sizeof(s->srv_conf.errorlog));
s->srv_conf.id = ++last_server_id;
+ s->srv_s = -1;
s->srv_conf.timeout.tv_sec = SERVER_TIMEOUT;
s->srv_conf.maxrequests = SERVER_MAXREQUESTS;
s->srv_conf.maxrequestbody = SERVER_MAXREQUESTBODY;
@@ -484,6 +485,7 @@ serveroptsl : LISTEN ON STRING opttls port {
/* A location entry uses the parent id */
s->srv_conf.id = srv->srv_conf.id;
s->srv_conf.flags = SRVFLAG_LOCATION;
+ s->srv_s = -1;
memcpy(&s->srv_conf.ss, &srv->srv_conf.ss,
sizeof(s->srv_conf.ss));
s->srv_conf.port = srv->srv_conf.port;
@@ -1760,6 +1762,8 @@ server_inherit(struct server *src, const char *name,
dst->srv_conf.tls_key = NULL;
dst->srv_conf.id = ++last_server_id;
+ dst->srv_s = -1;
+
if (last_server_id == INT_MAX) {
yyerror("too many servers defined");
serverconfig_free(&dst->srv_conf);
@@ -1824,6 +1828,7 @@ server_inherit(struct server *src, const char *name,
sizeof(dstl->srv_conf.ss));
dstl->srv_conf.port = addr->port;
dstl->srv_conf.prefixlen = addr->prefixlen;
+ dstl->srv_s = -1;
DPRINTF("adding location \"%s\" for \"%s[%u]\"",
dstl->srv_conf.location,