diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-11-28 14:37:44 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-11-28 19:20:40 +0300 |
commit | 679f259b952f418a8cf5edec9c071f3fa0e5850e (patch) | |
tree | 6e00d9105ff8cd59eda2397f247a01964553f828 /src/microhttpd/daemon.c | |
parent | 13cc9afe06a06e9f28a913b156922469f32be122 (diff) | |
download | libmicrohttpd-679f259b952f418a8cf5edec9c071f3fa0e5850e.tar.gz libmicrohttpd-679f259b952f418a8cf5edec9c071f3fa0e5850e.zip |
If socket error is detected, try to detect the type of error before closing
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 5dc92e13..95f10fdd 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1213,15 +1213,18 @@ call_handlers (struct MHD_Connection *con, | |||
1213 | if (con->tls_read_ready) | 1213 | if (con->tls_read_ready) |
1214 | read_ready = true; | 1214 | read_ready = true; |
1215 | #endif /* HTTPS_SUPPORT */ | 1215 | #endif /* HTTPS_SUPPORT */ |
1216 | if ( (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) && | ||
1217 | (read_ready || (force_close && con->sk_nonblck)) ) | ||
1218 | { | ||
1219 | MHD_connection_handle_read (con, force_close); | ||
1220 | mhd_assert (! force_close || MHD_CONNECTION_CLOSED == con->state); | ||
1221 | ret = MHD_connection_handle_idle (con); | ||
1222 | if (force_close) | ||
1223 | return ret; | ||
1224 | states_info_processed = true; | ||
1225 | } | ||
1216 | if (! force_close) | 1226 | if (! force_close) |
1217 | { | 1227 | { |
1218 | if ( (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) && | ||
1219 | read_ready) | ||
1220 | { | ||
1221 | MHD_connection_handle_read (con); | ||
1222 | ret = MHD_connection_handle_idle (con); | ||
1223 | states_info_processed = true; | ||
1224 | } | ||
1225 | /* No need to check value of 'ret' here as closed connection | 1228 | /* No need to check value of 'ret' here as closed connection |
1226 | * cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */ | 1229 | * cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */ |
1227 | if ( (MHD_EVENT_LOOP_INFO_WRITE == con->event_loop_info) && | 1230 | if ( (MHD_EVENT_LOOP_INFO_WRITE == con->event_loop_info) && |