aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-09-29 20:35:19 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-10-03 21:22:27 +0300
commit33ce983bb67fd94705247a9523c0881c68589107 (patch)
tree6fb32c400f161952fbb2932fcdf75764812f05fe /src
parent16f6b9460c6da8f32848bfdfd09cebf8f48d14b5 (diff)
downloadlibmicrohttpd-33ce983bb67fd94705247a9523c0881c68589107.tar.gz
libmicrohttpd-33ce983bb67fd94705247a9523c0881c68589107.zip
transmit_error_response(): use last resort to send error response
Diffstat (limited to 'src')
-rw-r--r--src/microhttpd/connection.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 47f9a6ae..a9619575 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2293,15 +2293,35 @@ transmit_error_response_len (struct MHD_Connection *connection,
2293 connection->keepalive = MHD_CONN_MUST_CLOSE; 2293 connection->keepalive = MHD_CONN_MUST_CLOSE;
2294 if (MHD_NO == build_header_response (connection)) 2294 if (MHD_NO == build_header_response (connection))
2295 { 2295 {
2296 /* oops - close! */ 2296 /* No memory. Release everything. */
2297 CONNECTION_CLOSE_ERROR (connection, 2297 connection->version = NULL;
2298 _ ("Closing connection " \ 2298 connection->method = NULL;
2299 "(failed to create error response header).")); 2299 connection->url = NULL;
2300 } 2300 connection->last = NULL;
2301 else 2301 connection->colon = NULL;
2302 { 2302 connection->headers_received = NULL;
2303 connection->state = MHD_CONNECTION_HEADERS_SENDING; 2303 connection->headers_received_tail = NULL;
2304 connection->write_buffer = NULL;
2305 connection->write_buffer_size = 0;
2306 connection->write_buffer_send_offset = 0;
2307 connection->write_buffer_append_offset = 0;
2308 connection->read_buffer
2309 = MHD_pool_reset (connection->pool,
2310 NULL,
2311 0,
2312 0);
2313 connection->read_buffer_size = 0;
2314
2315 /* Retry with empty buffer */
2316 if (MHD_NO == build_header_response (connection))
2317 {
2318 CONNECTION_CLOSE_ERROR (connection,
2319 _ ("Closing connection " \
2320 "(failed to create error response header)."));
2321 return;
2322 }
2304 } 2323 }
2324 connection->state = MHD_CONNECTION_HEADERS_SENDING;
2305} 2325}
2306 2326
2307 2327