libmicrohttpd

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

commit 1fb16b78538b1e20733b03a9bf6ae02c2adb2cbb
parent fe4fa4d3c2f47197da462fedbbd3aa364fab2279
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 18 Sep 2013 16:30:35 +0000

signal non-error termination properly if stream was simply terminated by client

Diffstat:
MChangeLog | 5+++++
Msrc/microhttpd/connection.c | 13+++++++------
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 18 18:29:24 CEST 2013 + Signal connection termination as OK (and not as ERROR) if the + stream was terminated by the callback returning + MHD_CONTENT_READER_END_OF_STREAM. -CG + Wed Sep 18 14:31:35 CEST 2013 Adding #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN. -CG diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -314,10 +314,10 @@ connection_close_error (struct MHD_Connection *connection, * sending. Assumes that the response mutex is * already held. If the transmission is complete, * this function may close the socket (and return - * MHD_NO). + * #MHD_NO). * * @param connection the connection - * @return MHD_NO if readying the response failed + * @return #MHD_NO if readying the response failed */ static int try_ready_normal_body (struct MHD_Connection *connection) @@ -364,10 +364,11 @@ try_ready_normal_body (struct MHD_Connection *connection) { /* either error or http 1.0 transfer, close socket! */ response->total_size = connection->response_write_position; - CONNECTION_CLOSE_ERROR (connection, - (ret == MHD_CONTENT_READER_END_OF_STREAM) - ? "Closing connection (end of response)\n" - : "Closing connection (stream error)\n"); + if (MHD_CONTENT_READER_END_OF_STREAM == ret) + MHD_connection_close (connection, MHD_REQUEST_TERMINATED_COMPLETD_OK); + else + CONNECTION_CLOSE_ERROR (connection, + "Closing connection (stream error)\n"); return MHD_NO; } response->data_start = connection->response_write_position;