diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2019-06-17 11:25:56 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2019-06-17 15:01:46 +0300 |
commit | 20767d5dec4abe6078ed73365cb566fe985a8319 (patch) | |
tree | 3102d7b78210137e6f6bd1a7616220159a7cba62 | |
parent | 4bc166ee2fc716f68e120fce514bd69a26146f28 (diff) | |
download | libmicrohttpd-20767d5dec4abe6078ed73365cb566fe985a8319.tar.gz libmicrohttpd-20767d5dec4abe6078ed73365cb566fe985a8319.zip |
transmit_error_response(): discard read buffer to free space for error response
-rw-r--r-- | src/microhttpd/connection.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index b3ef9441..9b8d3e2b 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -1995,6 +1995,16 @@ transmit_error_response (struct MHD_Connection *connection, | |||
1995 | } | 1995 | } |
1996 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; | 1996 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; |
1997 | connection->read_closed = true; | 1997 | connection->read_closed = true; |
1998 | if (0 != connection->read_buffer_size) | ||
1999 | { | ||
2000 | /* Read buffer is not needed anymore, discard it | ||
2001 | * to free some space for error response. */ | ||
2002 | connection->read_buffer = MHD_pool_reallocate(connection->pool, | ||
2003 | connection->read_buffer, | ||
2004 | connection->read_buffer_size, | ||
2005 | 0); | ||
2006 | connection->read_buffer_size = 0; | ||
2007 | } | ||
1998 | #ifdef HAVE_MESSAGES | 2008 | #ifdef HAVE_MESSAGES |
1999 | MHD_DLOG (connection->daemon, | 2009 | MHD_DLOG (connection->daemon, |
2000 | _("Error processing request (HTTP response code is %u (`%s')). Closing connection.\n"), | 2010 | _("Error processing request (HTTP response code is %u (`%s')). Closing connection.\n"), |