diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-09-29 17:30:15 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-09-29 20:44:14 +0300 |
commit | cb5332ab4328374822f3051e6effbfac1f03b815 (patch) | |
tree | 209e4a9db1be0067d675f85b7463e12a9a9f242a /src | |
parent | 4e01fd656aba4156d63e5a33e671dcfa8d8a8783 (diff) | |
download | libmicrohttpd-cb5332ab4328374822f3051e6effbfac1f03b815.tar.gz libmicrohttpd-cb5332ab4328374822f3051e6effbfac1f03b815.zip |
transmit_error_response(): avoid double sending of error responses
Diffstat (limited to 'src')
-rw-r--r-- | src/microhttpd/connection.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 65aa0842..a2049527 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -2200,6 +2200,14 @@ transmit_error_response_len (struct MHD_Connection *connection, | |||
2200 | struct MHD_Response *response; | 2200 | struct MHD_Response *response; |
2201 | enum MHD_Result iret; | 2201 | enum MHD_Result iret; |
2202 | 2202 | ||
2203 | mhd_assert (! connection->stop_with_error); /* Send error one time only */ | ||
2204 | if (connection->stop_with_error) | ||
2205 | { /* Should not happen */ | ||
2206 | if (MHD_CONNECTION_CLOSED > connection->state) | ||
2207 | connection->state = MHD_CONNECTION_CLOSED; | ||
2208 | |||
2209 | return; | ||
2210 | } | ||
2203 | connection->stop_with_error = true; | 2211 | connection->stop_with_error = true; |
2204 | /* TODO: remove when special error queue function is implemented */ | 2212 | /* TODO: remove when special error queue function is implemented */ |
2205 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; | 2213 | connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED; |