gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 02/02: Added MHD_OPTION_SIGPIPE_HANDLED_BY_APP option


From: gnunet
Subject: [libmicrohttpd] 02/02: Added MHD_OPTION_SIGPIPE_HANDLED_BY_APP option
Date: Wed, 17 Mar 2021 19:39:41 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 2e40251a934933f35413ea3ef978656f2eb0730a
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Mar 17 20:55:33 2021 +0300

    Added MHD_OPTION_SIGPIPE_HANDLED_BY_APP option
---
 src/include/microhttpd.h | 15 +++++++++++++--
 src/microhttpd/daemon.c  | 11 +++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 76847c9f..59170dfe 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -135,7 +135,7 @@ typedef intptr_t ssize_t;
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097204
+#define MHD_VERSION 0x00097205
 
 /**
  * Operational results from MHD calls.
@@ -1732,7 +1732,18 @@ enum MHD_OPTION
    * This argument must be followed by an "unsigned int", corresponding
    * to an `enum MHD_DisableSanityCheck`.
    */
-  MHD_OPTION_SERVER_INSANITY = 32
+  MHD_OPTION_SERVER_INSANITY = 32,
+
+  /**
+   * If followed by value '1' informs MHD that SIGPIPE is suppressed or
+   * handled by application. Allows MHD to use network functions that could
+   * generate SIGPIPE, like `sendfile()`.
+   * Valid only for daemons without #MHD_USE_INTERNAL_POLLING_THREAD as
+   * MHD automatically suppresses SIGPIPE for threads started by MHD.
+   * This option should be followed by an `int` argument.
+   * @note Available since #MHD_VERSION 0x00097205
+   */
+  MHD_OPTION_SIGPIPE_HANDLED_BY_APP = 33
 };
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 700cbeca..0fe47228 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5849,6 +5849,7 @@ parse_options_va (struct MHD_Daemon *daemon,
           break;
         /* all options taking 'int' */
         case MHD_OPTION_STRICT_FOR_CLIENT:
+        case MHD_OPTION_SIGPIPE_HANDLED_BY_APP:
           if (MHD_NO == parse_options (daemon,
                                        servaddr,
                                        opt,
@@ -5927,6 +5928,16 @@ parse_options_va (struct MHD_Daemon *daemon,
       return MHD_NO;
 #endif
 #endif /* HTTPS_SUPPORT */
+    case MHD_OPTION_SIGPIPE_HANDLED_BY_APP:
+      if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))
+        daemon->sigpipe_blocked = ( (va_arg (ap,
+                                             int)) != 0);
+      else
+      {
+        (void) va_arg (ap,
+                       int);
+      }
+      break;
     default:
 #ifdef HAVE_MESSAGES
       if ( ( (opt >= MHD_OPTION_HTTPS_MEM_KEY) &&

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