[core] disable keep-alive if forcing HTTP/1.0 resp

If an HTTP/1.1 request is configured to force an HTTP/1.0 response
(server.protocol-http11 = "disable"), then also disable keep-alive
(which is enabled by default in HTTP/1.1).  This overrides the
request header Connection: keep-alive (not re-validated), which is
unlikely to be sent with an HTTP/1.1 request.
personal/stbuehler/tests-path
Glenn Strauss 2022-02-13 03:11:48 -05:00
parent 2d1b16721c
commit e4d31e1b68
1 changed files with 4 additions and 1 deletions

View File

@ -350,8 +350,11 @@ static handler_t http_response_config (request_st * const r) {
/* do we have to downgrade from 1.1 to 1.0 ? (ignore for HTTP/2) */
if (__builtin_expect( (!r->conf.allow_http11), 0)
&& r->http_version == HTTP_VERSION_1_1)
&& r->http_version == HTTP_VERSION_1_1) {
r->http_version = HTTP_VERSION_1_0;
/*(when forcing HTTP/1.0, ignore (unlikely) Connection: keep-alive)*/
r->keep_alive = 0;
}
if (__builtin_expect( (r->reqbody_length > 0), 0)
&& 0 != r->conf.max_request_size /* r->conf.max_request_size in kB */