summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/server_http.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2020-01-14 20:48:58 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2020-01-14 20:48:58 +0000
commit6811b5bd8bcf24e482d5f788d2b17bfc4cf6416c (patch)
treeefd4ebc9ae7a4c6b1950c46f5a938e0cbadace80 /usr.sbin/httpd/server_http.c
parent07708bdadc0b2bf8ca88fc61137992522a70701a (diff)
Pick the value for "max requests number" from the correct server {}
section in the config, by moving the code down where the Host: header has been read and the correct server configuration selected. Note that it may not be that useful to have this option per server, because it is valid to send requests with different Host: headers over the same tcp connection. problem noted and diff from Tracey Emery, thanks! ok florian@
Diffstat (limited to 'usr.sbin/httpd/server_http.c')
-rw-r--r--usr.sbin/httpd/server_http.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c
index 326daa6a687..4a46f6b44ba 100644
--- a/usr.sbin/httpd/server_http.c
+++ b/usr.sbin/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.135 2019/11/04 14:58:37 benno Exp $ */
+/* $OpenBSD: server_http.c,v 1.136 2020/01/14 20:48:57 benno Exp $ */
/*
* Copyright (c) 2006 - 2018 Reyk Floeter <reyk@openbsd.org>
@@ -1232,13 +1232,6 @@ server_response(struct httpd *httpd, struct client *clt)
clt->clt_persist = 0;
}
- if (clt->clt_persist >= srv_conf->maxrequests)
- clt->clt_persist = 0;
-
- /* pipelining should end after the first "idempotent" method */
- if (clt->clt_pipelining && clt->clt_toread > 0)
- clt->clt_persist = 0;
-
/*
* Do we have a Host header and matching configuration?
* XXX the Host can also appear in the URL path.
@@ -1292,6 +1285,13 @@ server_response(struct httpd *httpd, struct client *clt)
srv_conf = clt->clt_srv_conf;
}
+ if (clt->clt_persist >= srv_conf->maxrequests)
+ clt->clt_persist = 0;
+
+ /* pipelining should end after the first "idempotent" method */
+ if (clt->clt_pipelining && clt->clt_toread > 0)
+ clt->clt_persist = 0;
+
if ((desc->http_host = strdup(hostname)) == NULL)
goto fail;