libmicrohttpd

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

commit d9ab40f53238b49c9f4a4df13e0262fbefb4a95a
parent fe8202d39c32032b68a7a6760651c843b2e3e16d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 28 Jun 2013 12:07:11 +0000

-cleaner behavior with respect to stopping to read pipelined requests

Diffstat:
MChangeLog | 8++++++++
Msrc/examples/demo.c | 1+
Msrc/microhttpd/connection.c | 9+++++++--
3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,11 @@ +Fri Jun 28 14:05:15 CEST 2013 + If we shutdown connection for reading on POST due to error, + really do not process further requests even if we already + read the next request from the connection. Furthermore, do + not shutdown connections for reading on GET/HEAD/etc. just + because the application queued a response immediately --- + reserve that behavior for PUT/POST. -CG + Tue May 21 14:34:36 CEST 2013 Improving configure tests for OpenSSL and spdylay to avoid build errors in libmicrospdy code if those libraries diff --git a/src/examples/demo.c b/src/examples/demo.c @@ -819,6 +819,7 @@ ignore_sigpipe () } #endif + /** * Entry point to demo. Note: this HTTP server will make all * files in the current directory and its subdirectories available diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2221,7 +2221,11 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) connection->state = MHD_CONNECTION_CONTINUE_SENDING; break; } - if (connection->response != NULL) + if ( (NULL != connection->response) && + ( (0 == strcasecmp (connection->method, + MHD_HTTP_METHOD_POST)) || + (0 == strcasecmp (connection->method, + MHD_HTTP_METHOD_PUT))) ) { /* we refused (no upload allowed!) */ connection->remaining_upload_size = 0; @@ -2413,7 +2417,8 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) end = MHD_get_response_header (connection->response, MHD_HTTP_HEADER_CONNECTION); - rend = ( (end != NULL) && (0 == strcasecmp (end, "close")) ); + rend = ( (MHD_YES == connection->read_closed) || + ( (end != NULL) && (0 == strcasecmp (end, "close")) ) ); MHD_destroy_response (connection->response); connection->response = NULL; if (connection->daemon->notify_completed != NULL)