gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (194b1222 -> dfbc4da6)


From: gnunet
Subject: [libmicrohttpd] branch master updated (194b1222 -> dfbc4da6)
Date: Thu, 07 Sep 2023 16:53:44 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 194b1222 perf_replies: disabled limit for maximum number of automatic 
threads
     new c19c0438 Allowed responses in special cases for backward-compatibility.
     new dfbc4da6 Simplified deinit on W32.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/microhttpd.h    | 10 ++++++++--
 src/microhttpd/connection.c | 35 ++++++++++++++++++++++++-----------
 src/microhttpd/daemon.c     | 16 +---------------
 3 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 8745367c..933f146a 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3528,8 +3528,14 @@ MHD_lookup_connection_value_n (struct MHD_Connection 
*connection,
  *
  * For any active connection this function must be called
  * only by #MHD_AccessHandlerCallback callback.
- * For suspended connection this function can be called at any moment. Response
- * will be sent as soon as connection is resumed.
+ *
+ * For suspended connection this function can be called at any moment (this
+ * behaviour is deprecated and will be removed!). Response  will be sent
+ * as soon as connection is resumed.
+ *
+ * For single thread environment, when MHD is used in "external polling" mode
+ * (without MHD_USE_SELECT_INTERNALLY) this function can be called any
+ * time (this behaviour is deprecated and will be removed!).
  *
  * If HTTP specifications require use no body in reply, like @a status_code 
with
  * value 1xx, the response body is automatically not sent even if it is present
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index d6b24297..9440d112 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -7078,8 +7078,14 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
  *
  * For any active connection this function must be called
  * only by #MHD_AccessHandlerCallback callback.
- * For suspended connection this function can be called at any moment. Response
- * will be sent as soon as connection is resumed.
+ *
+ * For suspended connection this function can be called at any moment (this
+ * behaviour is deprecated and will be removed!). Response  will be sent
+ * as soon as connection is resumed.
+ *
+ * For single thread environment, when MHD is used in "external polling" mode
+ * (without MHD_USE_SELECT_INTERNALLY) this function can be called any
+ * time (this behaviour is deprecated and will be removed!).
  *
  * If HTTP specifications require use no body in reply, like @a status_code 
with
  * value 1xx, the response body is automatically not sent even if it is present
@@ -7091,7 +7097,10 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
  * header is added automatically based the size of the body in the response.
  * If body size it set to #MHD_SIZE_UNKNOWN or chunked encoding is enforced
  * then "Transfer-Encoding: chunked" header (for HTTP/1.1 only) is added 
instead
- * of "Content-Length" header.
+ * of "Content-Length" header. For example, if response with zero-size body is
+ * used for HEAD request, then "Content-Length: 0" is added automatically to
+ * reply headers.
+ * @sa #MHD_RF_HEAD_ONLY_RESPONSE
  *
  * In situations, where reply body is required, like answer for the GET request
  * with @a status_code #MHD_HTTP_OK, headers "Content-Length" (for known body
@@ -7118,13 +7127,15 @@ MHD_queue_response (struct MHD_Connection *connection,
 
   if ((NULL == connection) || (NULL == response))
     return MHD_NO;
-  if (! connection->in_access_handler)
+
+  daemon = connection->daemon;
+  if ((! connection->in_access_handler) && (! connection->suspended) &&
+      (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)))
     return MHD_NO;
+
   reply_icy = (0 != (status_code & MHD_ICY_FLAG));
   status_code &= ~MHD_ICY_FLAG;
 
-  daemon = connection->daemon;
-
 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
   if ( (! connection->suspended) &&
        (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) &&
@@ -7138,15 +7149,17 @@ MHD_queue_response (struct MHD_Connection *connection,
   }
 #endif
 
+  if (NULL != connection->rp.response)
+    return MHD_NO; /* The response was already set */
+
+  if ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) &&
+       (MHD_CONNECTION_FULL_REQ_RECEIVED != connection->state) )
+    return MHD_NO; /* Wrong connection state */
+
   if (daemon->shutdown)
     return MHD_YES; /* If daemon was shut down in parallel,
                      * response will be aborted now or on later stage. */
 
-  if ( (NULL != connection->rp.response) ||
-       ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) &&
-         (MHD_CONNECTION_FULL_REQ_RECEIVED != connection->state) ) )
-    return MHD_NO;
-
 #ifdef UPGRADE_SUPPORT
   if (NULL != response->upgrade_handler)
   {
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 9b088803..4694afeb 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -131,14 +131,6 @@ MHD_epoll (struct MHD_Daemon *daemon,
 
 #endif /* EPOLL_SUPPORT */
 
-
-#if defined(MHD_WINSOCK_SOCKETS)
-/**
- * Track initialization of winsock
- */
-static int mhd_winsock_inited_ = 0;
-#endif /* MHD_WINSOCK_SOCKETS */
-
 #ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
 /**
  * Do nothing - global initialisation is
@@ -3195,10 +3187,6 @@ internal_suspend_connection_ (struct MHD_Connection 
*connection)
  * socket leaks or lead to undefined behavior).  You must explicitly
  * resume all connections before stopping the daemon.
  *
- * @remark In thread-per-connection mode: can be called from any thread,
- * in any other mode: to be called only from thread that process
- * daemon's select()/poll()/etc.
- *
  * @param connection the connection to suspend
  *
  * @sa #MHD_AccessHandlerCallback
@@ -8963,7 +8951,6 @@ MHD_init (void)
 #if defined(MHD_WINSOCK_SOCKETS)
   if (0 != WSAStartup (MAKEWORD (2, 2), &wsd))
     MHD_PANIC (_ ("Failed to initialize winsock.\n"));
-  mhd_winsock_inited_ = 1;
   if ((2 != LOBYTE (wsd.wVersion)) && (2 != HIBYTE (wsd.wVersion)))
     MHD_PANIC (_ ("Winsock version 2.2 is not available.\n"));
 #endif /* MHD_WINSOCK_SOCKETS */
@@ -9012,8 +8999,7 @@ MHD_fini (void)
   gnutls_global_deinit ();
 #endif /* HTTPS_SUPPORT */
 #if defined(MHD_WINSOCK_SOCKETS)
-  if (mhd_winsock_inited_)
-    WSACleanup ();
+  WSACleanup ();
 #endif /* MHD_WINSOCK_SOCKETS */
   MHD_monotonic_sec_counter_finish ();
 }

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