gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 06/10: transmit_error_response(): check whether it is st


From: gnunet
Subject: [libmicrohttpd] 06/10: transmit_error_response(): check whether it is still possible to send a response
Date: Wed, 29 Sep 2021 19:52:48 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 85afdbaf90d645532b0eeb07d33c7c6f1b5b960f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Sep 29 17:49:02 2021 +0300

    transmit_error_response(): check whether it is still possible to send a 
response
---
 src/microhttpd/connection.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 941b21a3..2f8f211c 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2209,6 +2209,26 @@ transmit_error_response_len (struct MHD_Connection 
*connection,
     return;
   }
   connection->stop_with_error = true;
+#ifdef HAVE_MESSAGES
+  MHD_DLOG (connection->daemon,
+            _ ("Error processing request (HTTP response code is %u ('%s')). " \
+               "Closing connection.\n"),
+            status_code,
+            message);
+#endif
+  if (MHD_CONNECTION_START_REPLY < connection->state)
+  {
+#ifdef HAVE_MESSAGES
+    MHD_DLOG (connection->daemon,
+              _ ("Too late to send an error response, " \
+                 "response is being sent already.\n"),
+              status_code,
+              message);
+#endif
+    CONNECTION_CLOSE_ERROR (connection,
+                            _ ("Too late for error response."));
+    return;
+  }
   /* TODO: remove when special error queue function is implemented */
   connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;
   if (0 != connection->read_buffer_size)
@@ -2221,13 +2241,6 @@ transmit_error_response_len (struct MHD_Connection 
*connection,
                                                    0);
     connection->read_buffer_size = 0;
   }
-#ifdef HAVE_MESSAGES
-  MHD_DLOG (connection->daemon,
-            _ (
-              "Error processing request (HTTP response code is %u (`%s')). 
Closing connection.\n"),
-            status_code,
-            message);
-#endif
   if (NULL != connection->response)
   {
     MHD_destroy_response (connection->response);

-- 
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]