diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-02-25 21:21:52 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-02-25 21:21:52 +0300 |
commit | 5398d8ba644dab2a5a24efaef9de7c9bc4b7e431 (patch) | |
tree | 5daad872a094c827c85da3a1f65674a3c89d4281 /src/microhttpd | |
parent | 228df068e3df8935655e3329bc8acc8614531c58 (diff) | |
download | libmicrohttpd-5398d8ba644dab2a5a24efaef9de7c9bc4b7e431.tar.gz libmicrohttpd-5398d8ba644dab2a5a24efaef9de7c9bc4b7e431.zip |
Fixed connection states processing error introduced by 813fc203ef95f7e3b1d410e182d363a30f5fdad3
Diffstat (limited to 'src/microhttpd')
-rw-r--r-- | src/microhttpd/daemon.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index f983e916..4a75b189 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -886,6 +886,7 @@ call_handlers (struct MHD_Connection *con, | |||
886 | bool force_close) | 886 | bool force_close) |
887 | { | 887 | { |
888 | int ret; | 888 | int ret; |
889 | bool states_info_processed = false; | ||
889 | /* Fast track flag */ | 890 | /* Fast track flag */ |
890 | bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); | 891 | bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); |
891 | 892 | ||
@@ -899,6 +900,7 @@ call_handlers (struct MHD_Connection *con, | |||
899 | { | 900 | { |
900 | con->read_handler (con); | 901 | con->read_handler (con); |
901 | ret = con->idle_handler (con); | 902 | ret = con->idle_handler (con); |
903 | states_info_processed = true; | ||
902 | } | 904 | } |
903 | /* No need to check value of 'ret' here as closed connection | 905 | /* No need to check value of 'ret' here as closed connection |
904 | * cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */ | 906 | * cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */ |
@@ -906,6 +908,7 @@ call_handlers (struct MHD_Connection *con, | |||
906 | { | 908 | { |
907 | con->write_handler (con); | 909 | con->write_handler (con); |
908 | ret = con->idle_handler (con); | 910 | ret = con->idle_handler (con); |
911 | states_info_processed = true; | ||
909 | } | 912 | } |
910 | } | 913 | } |
911 | else | 914 | else |
@@ -915,6 +918,11 @@ call_handlers (struct MHD_Connection *con, | |||
915 | return con->idle_handler (con); | 918 | return con->idle_handler (con); |
916 | } | 919 | } |
917 | 920 | ||
921 | if (!states_info_processed) | ||
922 | { /* Connection is not read or write ready, but external conditions | ||
923 | * may be changed and need to be processed. */ | ||
924 | ret = con->idle_handler (con); | ||
925 | } | ||
918 | /* Fast track for fast connections. */ | 926 | /* Fast track for fast connections. */ |
919 | /* If full request was read by single read_handler() invocation | 927 | /* If full request was read by single read_handler() invocation |
920 | and headers were completely prepared by single idle_handler() | 928 | and headers were completely prepared by single idle_handler() |
@@ -925,7 +933,7 @@ call_handlers (struct MHD_Connection *con, | |||
925 | only for non-blocking sockets. */ | 933 | only for non-blocking sockets. */ |
926 | /* No need to check 'ret' as connection is always in | 934 | /* No need to check 'ret' as connection is always in |
927 | * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */ | 935 | * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */ |
928 | if (on_fasttrack && con->sk_nonblck) | 936 | else if (on_fasttrack && con->sk_nonblck) |
929 | { | 937 | { |
930 | if (MHD_CONNECTION_HEADERS_SENDING == con->state) | 938 | if (MHD_CONNECTION_HEADERS_SENDING == con->state) |
931 | { | 939 | { |