aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r--src/microhttpd/connection.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index e29cca43..20bde652 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2405,7 +2405,6 @@ MHD_update_last_activity_ (struct MHD_Connection *connection)
2405int 2405int
2406MHD_connection_handle_read (struct MHD_Connection *connection) 2406MHD_connection_handle_read (struct MHD_Connection *connection)
2407{ 2407{
2408 MHD_update_last_activity_ (connection);
2409 if ( (MHD_CONNECTION_CLOSED == connection->state) || 2408 if ( (MHD_CONNECTION_CLOSED == connection->state) ||
2410 (connection->suspended) ) 2409 (connection->suspended) )
2411 return MHD_YES; 2410 return MHD_YES;
@@ -2416,6 +2415,7 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
2416 try_grow_read_buffer (connection); 2415 try_grow_read_buffer (connection);
2417 if (MHD_NO == do_read (connection)) 2416 if (MHD_NO == do_read (connection))
2418 return MHD_YES; 2417 return MHD_YES;
2418 MHD_update_last_activity_ (connection);
2419 while (1) 2419 while (1)
2420 { 2420 {
2421#if DEBUG_STATES 2421#if DEBUG_STATES
@@ -2480,7 +2480,6 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2480 if (connection->suspended) 2480 if (connection->suspended)
2481 return MHD_YES; 2481 return MHD_YES;
2482 2482
2483 MHD_update_last_activity_ (connection);
2484 while (1) 2483 while (1)
2485 { 2484 {
2486#if DEBUG_STATES 2485#if DEBUG_STATES
@@ -2529,6 +2528,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2529 &HTTP_100_CONTINUE[connection->continue_message_write_offset]); 2528 &HTTP_100_CONTINUE[connection->continue_message_write_offset]);
2530#endif 2529#endif
2531 connection->continue_message_write_offset += ret; 2530 connection->continue_message_write_offset += ret;
2531 MHD_update_last_activity_ (connection);
2532 break; 2532 break;
2533 case MHD_CONNECTION_CONTINUE_SENT: 2533 case MHD_CONNECTION_CONTINUE_SENT:
2534 case MHD_CONNECTION_BODY_RECEIVED: 2534 case MHD_CONNECTION_BODY_RECEIVED:
@@ -2537,7 +2537,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2537 EXTRA_CHECK (0); 2537 EXTRA_CHECK (0);
2538 break; 2538 break;
2539 case MHD_CONNECTION_HEADERS_SENDING: 2539 case MHD_CONNECTION_HEADERS_SENDING:
2540 do_write (connection); 2540 if (MHD_NO != do_write (connection))
2541 MHD_update_last_activity_ (connection);
2541 if (MHD_CONNECTION_HEADERS_SENDING != connection->state) 2542 if (MHD_CONNECTION_HEADERS_SENDING != connection->state)
2542 break; 2543 break;
2543 check_write_done (connection, 2544 check_write_done (connection,
@@ -2569,7 +2570,6 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2569 [(size_t)data_write_offset], 2570 [(size_t)data_write_offset],
2570 response->data_size - 2571 response->data_size -
2571 (size_t)data_write_offset); 2572 (size_t)data_write_offset);
2572 err = MHD_socket_get_error_ ();
2573#if DEBUG_SEND_DATA 2573#if DEBUG_SEND_DATA
2574 if (ret > 0) 2574 if (ret > 0)
2575 fprintf (stderr, 2575 fprintf (stderr,
@@ -2583,6 +2583,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2583 MHD_mutex_unlock_chk_ (&response->mutex); 2583 MHD_mutex_unlock_chk_ (&response->mutex);
2584 if (ret < 0) 2584 if (ret < 0)
2585 { 2585 {
2586 err = MHD_socket_get_error_ ();
2586 if (MHD_SCKT_ERR_IS_EINTR_ (err) || 2587 if (MHD_SCKT_ERR_IS_EINTR_ (err) ||
2587 MHD_SCKT_ERR_IS_EAGAIN_ (err)) 2588 MHD_SCKT_ERR_IS_EAGAIN_ (err))
2588 return MHD_YES; 2589 return MHD_YES;
@@ -2597,6 +2598,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2597 return MHD_YES; 2598 return MHD_YES;
2598 } 2599 }
2599 connection->response_write_position += ret; 2600 connection->response_write_position += ret;
2601 MHD_update_last_activity_ (connection);
2600 } 2602 }
2601 if (connection->response_write_position == 2603 if (connection->response_write_position ==
2602 connection->response->total_size) 2604 connection->response->total_size)
@@ -2606,7 +2608,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2606 EXTRA_CHECK (0); 2608 EXTRA_CHECK (0);
2607 break; 2609 break;
2608 case MHD_CONNECTION_CHUNKED_BODY_READY: 2610 case MHD_CONNECTION_CHUNKED_BODY_READY:
2609 do_write (connection); 2611 if (MHD_NO != do_write (connection))
2612 MHD_update_last_activity_ (connection);
2610 if (MHD_CONNECTION_CHUNKED_BODY_READY != connection->state) 2613 if (MHD_CONNECTION_CHUNKED_BODY_READY != connection->state)
2611 break; 2614 break;
2612 check_write_done (connection, 2615 check_write_done (connection,
@@ -2620,7 +2623,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2620 EXTRA_CHECK (0); 2623 EXTRA_CHECK (0);
2621 break; 2624 break;
2622 case MHD_CONNECTION_FOOTERS_SENDING: 2625 case MHD_CONNECTION_FOOTERS_SENDING:
2623 do_write (connection); 2626 if (MHD_NO != do_write (connection))
2627 MHD_update_last_activity_ (connection);
2624 if (MHD_CONNECTION_FOOTERS_SENDING != connection->state) 2628 if (MHD_CONNECTION_FOOTERS_SENDING != connection->state)
2625 break; 2629 break;
2626 check_write_done (connection, 2630 check_write_done (connection,