gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (4b3c7d9e -> 67f0f76b


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (4b3c7d9e -> 67f0f76b)
Date: Thu, 13 Jul 2017 20:45:08 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 4b3c7d9e test_shutdown_select/test_shutdown_poll: conditionally use 
test_shutdown_*_ignore to avoid XFAIL results
     new f4e8fc67 Restore SIGPIPE suppression in TLS mode broken by 
9e1db6c7b01e9e4cd790b3e8344e21ea2234c65d
     new 0078559f Added new value MHD_FEATURE_AUTOSUPPRESS_SIGPIPE for 
MHD_is_feature_supported()
     new 5f2517a9 Use MHD_FEATURE_AUTOSUPPRESS_SIGPIPE in testsuite
     new 67f0f76b Use GNUTLS_NONBLOCK (if available) for TLS sessions

The 4 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:
 ChangeLog                                |  6 ++++
 src/include/microhttpd.h                 | 11 ++++++--
 src/microhttpd/daemon.c                  | 48 ++++++++++++++++++++++++++++++--
 src/testcurl/test_get_response_cleanup.c | 19 +++++++------
 4 files changed, 72 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 178b7970..7e9a6f12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jul 13 21:41:00 MSK 2017
+       Restored SIGPIPE suppression in TLS mode.
+       Added new value MHD_FEATURE_AUTOSUPPRESS_SIGPIPE so application could
+       check whether SIGPIPE handling is required.
+       Used GNUTLS_NONBLOCK for TLS sessions. -EG
+
 Tue Jun 20 23:52:00 MSK 2017
        Libgcrypt is now optional and required only for old GnuTLS versions. -EG
 
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index de84e5d7..c5bf9a05 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t;
  * Current version of the library.
  * 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00095501
+#define MHD_VERSION 0x00095502
 
 /**
  * MHD-internal return code for "YES".
@@ -3452,7 +3452,14 @@ enum MHD_FEATURE
    * Get whether MHD support automatic detection of bind port number.
    * @sa #MHD_DAEMON_INFO_BIND_PORT
    */
-  MHD_FEATURE_AUTODETECT_BIND_PORT = 19
+  MHD_FEATURE_AUTODETECT_BIND_PORT = 19,
+
+  /**
+   * Get whether MHD support SIGPIPE suppression.
+   * If SIGPIPE suppression is not supported, application must handle
+   * SIGPIPE signal by itself.
+   */
+  MHD_FEATURE_AUTOSUPPRESS_SIGPIPE = 20
 };
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 1f349a26..88dabed5 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2044,6 +2044,35 @@ exit:
 static void
 MHD_cleanup_connections (struct MHD_Daemon *daemon);
 
+#if defined(HTTPS_SUPPORT)
+#if !defined(MHD_WINSOCK_SOCKETS) && !defined(MHD_socket_nosignal_) && \
+    (GNUTLS_VERSION_NUMBER+0 < 0x030402) && defined(MSG_NOSIGNAL)
+/**
+ * Older version of GnuTLS do not support suppressing of SIGPIPE signal.
+ * Use push function replacement with suppressing SIGPIPE signal where 
necessary
+ * and if possible.
+ */
+#define MHD_TLSLIB_NEED_PUSH_FUNC 1
+#endif /* !_WIN32 && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 
0x030402) */
+
+#ifdef MHD_TLSLIB_NEED_PUSH_FUNC
+/**
+ * Data push function replacement with suppressing SIGPIPE signal
+ * for TLS library.
+ */
+static ssize_t
+MHD_tls_push_func_(gnutls_transport_ptr_t trnsp,
+                   const void *data,
+                   size_t data_size)
+{
+#if (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX)
+  if (data_size > MHD_SCKT_SEND_MAX_SIZE_)
+    data_size = MHD_SCKT_SEND_MAX_SIZE_;
+#endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */
+  return MHD_send_ ((MHD_socket)(intptr_t)(trnsp), data, data_size);
+}
+#endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */
+#endif /* HTTPS_SUPPORT */
 
 /**
  * Add another client connection to the set of connections
@@ -2263,7 +2292,14 @@ internal_add_connection (struct MHD_Daemon *daemon,
       connection->tls_state = MHD_TLS_CONN_INIT;
       MHD_set_https_callbacks (connection);
       gnutls_init (&connection->tls_session,
-                   GNUTLS_SERVER);
+                   GNUTLS_SERVER
+#if (GNUTLS_VERSION_NUMBER+0 >= 0x030402)
+                   | GNUTLS_NO_SIGNAL
+#endif /* GNUTLS_VERSION_NUMBER >= 0x030402 */
+#if GNUTLS_VERSION_MAJOR >= 3
+                   | GNUTLS_NONBLOCK
+#endif /* GNUTLS_VERSION_MAJOR >= 3*/
+                  );
       gnutls_priority_set (connection->tls_session,
                           daemon->priority_cache);
       switch (daemon->cred_type)
@@ -2297,7 +2333,9 @@ internal_add_connection (struct MHD_Daemon *daemon,
 #else  /* GnuTLS before 3.1.9 or Win x64 */
       gnutls_transport_set_ptr (connection->tls_session, 
(gnutls_transport_ptr_t)(intptr_t)(client_socket));
 #endif /* GnuTLS before 3.1.9 */
-
+#ifdef MHD_TLSLIB_NEED_PUSH_FUNC
+      gnutls_transport_set_push_function (connection->tls_session, 
MHD_tls_push_func_);
+#endif /* MHD_TLSLIB_NEED_PUSH_FUNC */
       if (daemon->https_mem_trust)
          gnutls_certificate_server_set_request (connection->tls_session,
                                                 GNUTLS_CERT_REQUEST);
@@ -6517,6 +6555,12 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
 #else
       return MHD_NO;
 #endif
+    case MHD_FEATURE_AUTOSUPPRESS_SIGPIPE:
+#if defined(MHD_WINSOCK_SOCKETS) || defined(MHD_socket_nosignal_) || defined 
(MSG_NOSIGNAL)
+      return MHD_YES;
+#else
+      return MHD_NO;
+#endif
     }
   return MHD_NO;
 }
diff --git a/src/testcurl/test_get_response_cleanup.c 
b/src/testcurl/test_get_response_cleanup.c
index 03552ba0..aeb982e9 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -35,9 +35,9 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <fcntl.h>
-#ifdef __sun
+#ifndef _WIN32
 #include <signal.h>
-#endif /* __sun */
+#endif /* _WIN32 */
 
 #ifndef WINDOWS
 #include <sys/socket.h>
@@ -386,13 +386,16 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
-#ifdef __sun
-  struct sigaction act;
-
+#ifndef _WIN32
   /* Solaris has no way to disable SIGPIPE on socket disconnect. */
-  act.sa_handler = SIG_IGN;
-  sigaction(SIGPIPE, &act, NULL);
-#endif /* __sun */
+  if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE))
+    {
+      struct sigaction act;
+
+      act.sa_handler = SIG_IGN;
+      sigaction(SIGPIPE, &act, NULL);
+    }
+#endif /* _WIN32 */
 
   oneone = (NULL != strrchr (argv[0], (int) '/')) ?
     (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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