aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/connection.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-05-15 20:04:11 +0000
committerChristian Grothoff <christian@grothoff.org>2013-05-15 20:04:11 +0000
commita39c6c5206d6542e51e032d0fa659a87ad5384ba (patch)
treeacf14d3b9da2a08a8d7ad8237b5e838689627b0f /src/microhttpd/connection.c
parent76929295b7f283fd763b7c908831e8fcb1216600 (diff)
downloadlibmicrohttpd-a39c6c5206d6542e51e032d0fa659a87ad5384ba.tar.gz
libmicrohttpd-a39c6c5206d6542e51e032d0fa659a87ad5384ba.zip
-2nd attempt to fix #2859, this time things look much better
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r--src/microhttpd/connection.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 9dfbfd5e..d01d8260 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2034,16 +2034,6 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2034 pthread_mutex_unlock (&response->mutex); 2034 pthread_mutex_unlock (&response->mutex);
2035 break; 2035 break;
2036 } 2036 }
2037#if 0
2038 if (response->data_size == connection->response_write_position - response->data_start)
2039 {
2040 /* nothing to transmit, move on */
2041 if (response->crc != NULL)
2042 pthread_mutex_unlock (&response->mutex);
2043 connection->state = MHD_CONNECTION_BODY_SENT;
2044 return MHD_YES;
2045 }
2046#endif
2047 ret = connection->send_cls (connection, 2037 ret = connection->send_cls (connection,
2048 &response->data 2038 &response->data
2049 [connection->response_write_position 2039 [connection->response_write_position
@@ -2359,6 +2349,13 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2359 case MHD_CONNECTION_NORMAL_BODY_UNREADY: 2349 case MHD_CONNECTION_NORMAL_BODY_UNREADY:
2360 if (connection->response->crc != NULL) 2350 if (connection->response->crc != NULL)
2361 pthread_mutex_lock (&connection->response->mutex); 2351 pthread_mutex_lock (&connection->response->mutex);
2352 if (0 == connection->response->total_size)
2353 {
2354 if (connection->response->crc != NULL)
2355 pthread_mutex_unlock (&connection->response->mutex);
2356 connection->state = MHD_CONNECTION_BODY_SENT;
2357 continue;
2358 }
2362 if (MHD_YES == try_ready_normal_body (connection)) 2359 if (MHD_YES == try_ready_normal_body (connection))
2363 { 2360 {
2364 if (connection->response->crc != NULL) 2361 if (connection->response->crc != NULL)
@@ -2376,6 +2373,13 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2376 case MHD_CONNECTION_CHUNKED_BODY_UNREADY: 2373 case MHD_CONNECTION_CHUNKED_BODY_UNREADY:
2377 if (connection->response->crc != NULL) 2374 if (connection->response->crc != NULL)
2378 pthread_mutex_lock (&connection->response->mutex); 2375 pthread_mutex_lock (&connection->response->mutex);
2376 if (0 == connection->response->total_size)
2377 {
2378 if (connection->response->crc != NULL)
2379 pthread_mutex_unlock (&connection->response->mutex);
2380 connection->state = MHD_CONNECTION_BODY_SENT;
2381 continue;
2382 }
2379 if (MHD_YES == try_ready_chunked_body (connection)) 2383 if (MHD_YES == try_ready_chunked_body (connection))
2380 { 2384 {
2381 if (connection->response->crc != NULL) 2385 if (connection->response->crc != NULL)