aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-18 16:30:35 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-18 16:30:35 +0000
commit1fb16b78538b1e20733b03a9bf6ae02c2adb2cbb (patch)
treef30f1950a4662704585ae2ab11b68e7ddd227e45
parentfe4fa4d3c2f47197da462fedbbd3aa364fab2279 (diff)
downloadlibmicrohttpd-1fb16b78538b1e20733b03a9bf6ae02c2adb2cbb.tar.gz
libmicrohttpd-1fb16b78538b1e20733b03a9bf6ae02c2adb2cbb.zip
signal non-error termination properly if stream was simply terminated by client
-rw-r--r--ChangeLog5
-rw-r--r--src/microhttpd/connection.c13
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4945f691..296f0d20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
1Wed Sep 18 18:29:24 CEST 2013
2 Signal connection termination as OK (and not as ERROR) if the
3 stream was terminated by the callback returning
4 MHD_CONTENT_READER_END_OF_STREAM. -CG
5
1Wed Sep 18 14:31:35 CEST 2013 6Wed Sep 18 14:31:35 CEST 2013
2 Adding #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN. -CG 7 Adding #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN. -CG
3 8
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 4e6fed5a..1a75eb28 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -314,10 +314,10 @@ connection_close_error (struct MHD_Connection *connection,
314 * sending. Assumes that the response mutex is 314 * sending. Assumes that the response mutex is
315 * already held. If the transmission is complete, 315 * already held. If the transmission is complete,
316 * this function may close the socket (and return 316 * this function may close the socket (and return
317 * MHD_NO). 317 * #MHD_NO).
318 * 318 *
319 * @param connection the connection 319 * @param connection the connection
320 * @return MHD_NO if readying the response failed 320 * @return #MHD_NO if readying the response failed
321 */ 321 */
322static int 322static int
323try_ready_normal_body (struct MHD_Connection *connection) 323try_ready_normal_body (struct MHD_Connection *connection)
@@ -364,10 +364,11 @@ try_ready_normal_body (struct MHD_Connection *connection)
364 { 364 {
365 /* either error or http 1.0 transfer, close socket! */ 365 /* either error or http 1.0 transfer, close socket! */
366 response->total_size = connection->response_write_position; 366 response->total_size = connection->response_write_position;
367 CONNECTION_CLOSE_ERROR (connection, 367 if (MHD_CONTENT_READER_END_OF_STREAM == ret)
368 (ret == MHD_CONTENT_READER_END_OF_STREAM) 368 MHD_connection_close (connection, MHD_REQUEST_TERMINATED_COMPLETD_OK);
369 ? "Closing connection (end of response)\n" 369 else
370 : "Closing connection (stream error)\n"); 370 CONNECTION_CLOSE_ERROR (connection,
371 "Closing connection (stream error)\n");
371 return MHD_NO; 372 return MHD_NO;
372 } 373 }
373 response->data_start = connection->response_write_position; 374 response->data_start = connection->response_write_position;