commit b7052c04159e2d04482328f518dafc27e358cc65
parent 700f23d5d7153ce5de8617ac8d257828899d6f66
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 19 Dec 2018 00:06:48 +0100
Check should (indeed) be for GNUTLS_E_AGAIN.
Lasa Martxel wrote:
Hello,
I have found the following code in daemon.c file, lines 1449 to 1467:
if (0 >= res)
{
if (GNUTLS_E_INTERRUPTED != res)
{
urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY;
if (GNUTLS_E_INTERRUPTED != res)
(GNUTLS_E_INTERRUPTED != res) is checked twice.
In the read part (a few lines above), GNUTLS_E_INTERRUPTED != res is checked first and then GNUTLS_E_AGAIN != res. It looks like something similar should be done here, but I’m not sure.
Thanks,
Martxel
Diffstat:
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Dec 19 00:06:03 CET 2018
+ Check for GNUTLS_E_AGAIN instead of GNUTLS_E_INTERRUPTED when
+ giving up on a TLS connection. -LM/CG
+
Thu Dec 13 22:48:14 CET 2018
Fix connection timeout logic if in thread-per-connection mode the
working thread takes longer than the timeout to queue the response. -CG
diff --git 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 0x00096202
+#define MHD_VERSION 0x00096203
/**
* MHD-internal return code for "YES".
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -1451,7 +1451,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
if (GNUTLS_E_INTERRUPTED != res)
{
urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY;
- if (GNUTLS_E_INTERRUPTED != res)
+ if (GNUTLS_E_AGAIN != res)
{
/* TLS connection shut down or
* persistent / unrecoverable error. */
@@ -2740,7 +2740,7 @@ internal_suspend_connection_ (struct MHD_Connection *connection)
connection->epoll_state |= MHD_EPOLL_STATE_SUSPENDED;
}
#endif
-#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
#endif
}
@@ -2949,7 +2949,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
}
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
-#endif
+#endif
if ( (used_thr_p_c) &&
(MHD_NO != ret) )
{ /* Wake up suspended connections. */
@@ -3121,7 +3121,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
}
else
{
-#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
#endif
daemon->at_limit = true;
@@ -4640,7 +4640,7 @@ unescape_wrapper (void *cls,
char *val)
{
(void) cls; /* Mute compiler warning. */
-
+
(void) connection; /* Mute compiler warning. */
return MHD_http_unescape (val);
}
@@ -4731,7 +4731,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
#endif
return MHD_INVALID_SOCKET;
}
-
+
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
if (NULL != daemon->worker_pool)
for (i = 0; i < daemon->worker_pool_size; i++)
@@ -6091,7 +6091,7 @@ MHD_start_daemon_va (unsigned int flags,
MHD_socket_last_strerr_());
#endif
if (0 != (*pflags & MHD_USE_EPOLL)
-#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
|| (daemon->worker_pool_size > 0)
#endif
)
@@ -6555,7 +6555,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
unsigned int i;
#endif
-
+
if (NULL == daemon)
return;