gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: transmit_error_response(): use la


From: gnunet
Subject: [libmicrohttpd] branch master updated: transmit_error_response(): use last resort to send error response
Date: Sun, 03 Oct 2021 20:22:37 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 33ce983b transmit_error_response(): use last resort to send error 
response
33ce983b is described below

commit 33ce983bb67fd94705247a9523c0881c68589107
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Sep 29 20:35:19 2021 +0300

    transmit_error_response(): use last resort to send error response
---
 src/microhttpd/connection.c | 36 ++++++++++++++++++++++++++++--------
 1 file 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,
   connection->keepalive = MHD_CONN_MUST_CLOSE;
   if (MHD_NO == build_header_response (connection))
   {
-    /* oops - close! */
-    CONNECTION_CLOSE_ERROR (connection,
-                            _ ("Closing connection " \
-                               "(failed to create error response header)."));
-  }
-  else
-  {
-    connection->state = MHD_CONNECTION_HEADERS_SENDING;
+    /* No memory. Release everything. */
+    connection->version = NULL;
+    connection->method = NULL;
+    connection->url = NULL;
+    connection->last = NULL;
+    connection->colon = NULL;
+    connection->headers_received = NULL;
+    connection->headers_received_tail = NULL;
+    connection->write_buffer = NULL;
+    connection->write_buffer_size = 0;
+    connection->write_buffer_send_offset = 0;
+    connection->write_buffer_append_offset = 0;
+    connection->read_buffer
+      = MHD_pool_reset (connection->pool,
+                        NULL,
+                        0,
+                        0);
+    connection->read_buffer_size = 0;
+
+    /* Retry with empty buffer */
+    if (MHD_NO == build_header_response (connection))
+    {
+      CONNECTION_CLOSE_ERROR (connection,
+                              _ ("Closing connection " \
+                                 "(failed to create error response header)."));
+      return;
+    }
   }
+  connection->state = MHD_CONNECTION_HEADERS_SENDING;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]