mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 04:19:10 -04:00
close connections for http/1.0 unless there is keep-alive
svn:r326
This commit is contained in:
parent
19373b3dda
commit
36950cef58
13
http.c
13
http.c
@ -316,6 +316,14 @@ evhttp_is_connection_close(struct evkeyvalq* headers)
|
|||||||
return (connection != NULL && strcasecmp(connection, "close") == 0);
|
return (connection != NULL && strcasecmp(connection, "close") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
evhttp_is_connection_keepalive(struct evkeyvalq* headers)
|
||||||
|
{
|
||||||
|
const char *connection = evhttp_find_header(headers, "Connection");
|
||||||
|
return (connection != NULL
|
||||||
|
&& strncasecmp(connection, "keep-alive", 10) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the headers needed for an HTTP reply
|
* Create the headers needed for an HTTP reply
|
||||||
*/
|
*/
|
||||||
@ -1493,7 +1501,10 @@ evhttp_send_done(struct evhttp_connection *evcon, void *arg)
|
|||||||
/* delete possible close detection events */
|
/* delete possible close detection events */
|
||||||
evhttp_connection_stop_detectclose(evcon);
|
evhttp_connection_stop_detectclose(evcon);
|
||||||
|
|
||||||
need_close = evhttp_is_connection_close(req->input_headers) ||
|
need_close =
|
||||||
|
(req->minor == 0 &&
|
||||||
|
!evhttp_is_connection_keepalive(req->input_headers))||
|
||||||
|
evhttp_is_connection_close(req->input_headers) ||
|
||||||
evhttp_is_connection_close(req->output_headers);
|
evhttp_is_connection_close(req->output_headers);
|
||||||
|
|
||||||
assert(req->flags & EVHTTP_REQ_OWN_CONNECTION);
|
assert(req->flags & EVHTTP_REQ_OWN_CONNECTION);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user