diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-05 23:27:04 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-05 23:48:10 +0300 |
commit | 37518ba48fa12c128d7615f2f1d3dc2f281e8dfd (patch) | |
tree | d1fcce591bbc50e303c21314b55b6dc36bcc94de /src/microhttpd/connection.c | |
parent | 74f0569b5e3f10f9f708ada03c71b77f10f26081 (diff) | |
download | libmicrohttpd-37518ba48fa12c128d7615f2f1d3dc2f281e8dfd.tar.gz libmicrohttpd-37518ba48fa12c128d7615f2f1d3dc2f281e8dfd.zip |
MHD_connection_handle_read(): simplified and unified code, removed dead code.
Functionality is unchanged.
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 38a700fb..eb3b09f6 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2717,48 +2717,43 @@ MHD_connection_handle_read (struct MHD_Connection *connection) | |||
2717 | } | 2717 | } |
2718 | connection->read_buffer_offset += bytes_read; | 2718 | connection->read_buffer_offset += bytes_read; |
2719 | MHD_update_last_activity_ (connection); | 2719 | MHD_update_last_activity_ (connection); |
2720 | while (1) | ||
2721 | { | ||
2722 | #if DEBUG_STATES | 2720 | #if DEBUG_STATES |
2723 | MHD_DLOG (connection->daemon, | 2721 | MHD_DLOG (connection->daemon, |
2724 | _("In function %s handling connection at state: %s\n"), | 2722 | _("In function %s handling connection at state: %s\n"), |
2725 | __FUNCTION__, | 2723 | __FUNCTION__, |
2726 | MHD_state_to_string (connection->state)); | 2724 | MHD_state_to_string (connection->state)); |
2727 | #endif | 2725 | #endif |
2728 | switch (connection->state) | 2726 | switch (connection->state) |
2727 | { | ||
2728 | case MHD_CONNECTION_INIT: | ||
2729 | case MHD_CONNECTION_URL_RECEIVED: | ||
2730 | case MHD_CONNECTION_HEADER_PART_RECEIVED: | ||
2731 | case MHD_CONNECTION_HEADERS_RECEIVED: | ||
2732 | case MHD_CONNECTION_HEADERS_PROCESSED: | ||
2733 | case MHD_CONNECTION_CONTINUE_SENDING: | ||
2734 | case MHD_CONNECTION_CONTINUE_SENT: | ||
2735 | case MHD_CONNECTION_BODY_RECEIVED: | ||
2736 | case MHD_CONNECTION_FOOTER_PART_RECEIVED: | ||
2737 | /* nothing to do but default action */ | ||
2738 | if (connection->read_closed) | ||
2729 | { | 2739 | { |
2730 | case MHD_CONNECTION_INIT: | 2740 | MHD_connection_close_ (connection, |
2731 | case MHD_CONNECTION_URL_RECEIVED: | 2741 | MHD_REQUEST_TERMINATED_READ_ERROR); |
2732 | case MHD_CONNECTION_HEADER_PART_RECEIVED: | 2742 | } |
2733 | case MHD_CONNECTION_HEADERS_RECEIVED: | 2743 | return; |
2734 | case MHD_CONNECTION_HEADERS_PROCESSED: | 2744 | case MHD_CONNECTION_CLOSED: |
2735 | case MHD_CONNECTION_CONTINUE_SENDING: | 2745 | return; |
2736 | case MHD_CONNECTION_CONTINUE_SENT: | ||
2737 | case MHD_CONNECTION_BODY_RECEIVED: | ||
2738 | case MHD_CONNECTION_FOOTER_PART_RECEIVED: | ||
2739 | /* nothing to do but default action */ | ||
2740 | if (connection->read_closed) | ||
2741 | { | ||
2742 | MHD_connection_close_ (connection, | ||
2743 | MHD_REQUEST_TERMINATED_READ_ERROR); | ||
2744 | continue; | ||
2745 | } | ||
2746 | break; | ||
2747 | case MHD_CONNECTION_CLOSED: | ||
2748 | return; | ||
2749 | #ifdef UPGRADE_SUPPORT | 2746 | #ifdef UPGRADE_SUPPORT |
2750 | case MHD_CONNECTION_UPGRADE: | 2747 | case MHD_CONNECTION_UPGRADE: |
2751 | EXTRA_CHECK (0); | 2748 | EXTRA_CHECK (0); |
2752 | break; | 2749 | return; |
2753 | #endif /* UPGRADE_SUPPORT */ | 2750 | #endif /* UPGRADE_SUPPORT */ |
2754 | default: | 2751 | default: |
2755 | /* shrink read buffer to how much is actually used */ | 2752 | /* shrink read buffer to how much is actually used */ |
2756 | MHD_pool_reallocate (connection->pool, | 2753 | MHD_pool_reallocate (connection->pool, |
2757 | connection->read_buffer, | 2754 | connection->read_buffer, |
2758 | connection->read_buffer_size + 1, | 2755 | connection->read_buffer_size + 1, |
2759 | connection->read_buffer_offset); | 2756 | connection->read_buffer_offset); |
2760 | break; | ||
2761 | } | ||
2762 | break; | 2757 | break; |
2763 | } | 2758 | } |
2764 | return; | 2759 | return; |