libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit bbe7aa94e0f3591dee30e39e81c81fe657f93eb7
parent 0a930d349c92cffb9b53d750f319816f0785286f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 20 Dec 2014 01:31:24 +0000

-just to be sure, also check if client set Connection: close at the end

Diffstat:
Msrc/microhttpd/connection.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2291,6 +2291,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) unsigned int timeout; const char *end; char *line; + int client_close; connection->in_idle = MHD_YES; while (1) @@ -2589,6 +2590,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) end = MHD_get_response_header (connection->response, MHD_HTTP_HEADER_CONNECTION); + client_close = ((NULL != end) && (0 == strcasecmp (end, "close"))); MHD_destroy_response (connection->response); connection->response = NULL; if ( (NULL != daemon->notify_completed) && @@ -2604,6 +2606,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONNECTION); if ( (MHD_YES == connection->read_closed) || + (client_close) || ((NULL != end) && (0 == strcasecmp (end, "close"))) ) { connection->read_closed = MHD_YES;