diff options
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index bd96b1cf..5cbb30ed 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2126,8 +2126,9 @@ transmit_error_response_len (struct MHD_Connection *connection, | |||
2126 | struct MHD_Response *response; | 2126 | struct MHD_Response *response; |
2127 | enum MHD_Result iret; | 2127 | enum MHD_Result iret; |
2128 | 2128 | ||
2129 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; | ||
2130 | connection->stop_with_error = true; | 2129 | connection->stop_with_error = true; |
2130 | /* TODO: remove when special error queue function is implemented */ | ||
2131 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; | ||
2131 | if (0 != connection->read_buffer_size) | 2132 | if (0 != connection->read_buffer_size) |
2132 | { | 2133 | { |
2133 | /* Read buffer is not needed anymore, discard it | 2134 | /* Read buffer is not needed anymore, discard it |
@@ -2321,6 +2322,9 @@ MHD_connection_update_event_loop_info (struct MHD_Connection *connection) | |||
2321 | case MHD_CONNECTION_FULL_REQ_RECEIVED: | 2322 | case MHD_CONNECTION_FULL_REQ_RECEIVED: |
2322 | connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; | 2323 | connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; |
2323 | break; | 2324 | break; |
2325 | case MHD_CONNECTION_START_REPLY: | ||
2326 | mhd_assert (0); | ||
2327 | break; | ||
2324 | case MHD_CONNECTION_HEADERS_SENDING: | 2328 | case MHD_CONNECTION_HEADERS_SENDING: |
2325 | /* headers in buffer, keep writing */ | 2329 | /* headers in buffer, keep writing */ |
2326 | connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; | 2330 | connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; |
@@ -3332,8 +3336,8 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
3332 | enum MHD_Result iret; | 3336 | enum MHD_Result iret; |
3333 | 3337 | ||
3334 | /* die, http 1.1 request without host and we are pedantic */ | 3338 | /* die, http 1.1 request without host and we are pedantic */ |
3335 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; | ||
3336 | connection->stop_with_error = true; | 3339 | connection->stop_with_error = true; |
3340 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; | ||
3337 | #ifdef HAVE_MESSAGES | 3341 | #ifdef HAVE_MESSAGES |
3338 | MHD_DLOG (connection->daemon, | 3342 | MHD_DLOG (connection->daemon, |
3339 | _ ("Received HTTP 1.1 request without `Host' header.\n")); | 3343 | _ ("Received HTTP 1.1 request without `Host' header.\n")); |
@@ -3644,6 +3648,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
3644 | case MHD_CONNECTION_FOOTER_PART_RECEIVED: | 3648 | case MHD_CONNECTION_FOOTER_PART_RECEIVED: |
3645 | case MHD_CONNECTION_FOOTERS_RECEIVED: | 3649 | case MHD_CONNECTION_FOOTERS_RECEIVED: |
3646 | case MHD_CONNECTION_FULL_REQ_RECEIVED: | 3650 | case MHD_CONNECTION_FULL_REQ_RECEIVED: |
3651 | case MHD_CONNECTION_START_REPLY: | ||
3647 | mhd_assert (0); | 3652 | mhd_assert (0); |
3648 | return; | 3653 | return; |
3649 | case MHD_CONNECTION_HEADERS_SENDING: | 3654 | case MHD_CONNECTION_HEADERS_SENDING: |
@@ -4341,18 +4346,23 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
4341 | continue; | 4346 | continue; |
4342 | if (NULL == connection->response) | 4347 | if (NULL == connection->response) |
4343 | break; /* try again next time */ | 4348 | break; /* try again next time */ |
4344 | 4349 | /* Response is ready, start reply */ | |
4350 | connection->state = MHD_CONNECTION_START_REPLY; | ||
4351 | continue; | ||
4352 | case MHD_CONNECTION_START_REPLY: | ||
4353 | mhd_assert (NULL != connection->response); | ||
4345 | connection_switch_from_recv_to_send (connection); | 4354 | connection_switch_from_recv_to_send (connection); |
4346 | if (MHD_NO == build_header_response (connection)) | 4355 | if (MHD_NO == build_header_response (connection)) |
4347 | { | 4356 | { |
4348 | /* oops - close! */ | 4357 | /* oops - close! */ |
4349 | CONNECTION_CLOSE_ERROR (connection, | 4358 | CONNECTION_CLOSE_ERROR (connection, |
4350 | _ ( | 4359 | _ ("Closing connection (failed to create " |
4351 | "Closing connection (failed to create response header).\n")); | 4360 | "response header).\n")); |
4352 | continue; | 4361 | continue; |
4353 | } | 4362 | } |
4354 | connection->state = MHD_CONNECTION_HEADERS_SENDING; | 4363 | connection->state = MHD_CONNECTION_HEADERS_SENDING; |
4355 | break; | 4364 | break; |
4365 | |||
4356 | case MHD_CONNECTION_HEADERS_SENDING: | 4366 | case MHD_CONNECTION_HEADERS_SENDING: |
4357 | /* no default action */ | 4367 | /* no default action */ |
4358 | break; | 4368 | break; |
@@ -4904,7 +4914,7 @@ MHD_queue_response (struct MHD_Connection *connection, | |||
4904 | /* response was queued "early", refuse to read body / footers or | 4914 | /* response was queued "early", refuse to read body / footers or |
4905 | further requests! */ | 4915 | further requests! */ |
4906 | connection->stop_with_error = true; | 4916 | connection->stop_with_error = true; |
4907 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; | 4917 | connection->state = MHD_CONNECTION_START_REPLY; |
4908 | connection->remaining_upload_size = 0; | 4918 | connection->remaining_upload_size = 0; |
4909 | } | 4919 | } |
4910 | if (! connection->in_idle) | 4920 | if (! connection->in_idle) |