libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 88fee01b55e7b49026fbbdcbb4d890e90cd3b743
parent 93331888248acede57cb3ea2511456b993e66972
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu, 16 Mar 2017 23:14:35 +0300

Fixed logic of idle disconnection: connection should be disconnected not early than "timeout",
not before "timeout" number of seconds.

Diffstat:
MChangeLog | 4++++
Msrc/microhttpd/connection.c | 2+-
Msrc/microhttpd/connection_https.c | 2+-
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +Thu Mar 16 23:12:07 MSK 2017 + Idle connection should be disconnected *after* "timeout" number of + second, not *before* this number. -EG/VT + Thu Mar 16 22:31:54 MSK 2017 Unified update of last activity on connections. Update last activity only if something is really transmitted. diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -3219,7 +3219,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) unsigned int timeout; timeout = connection->connection_timeout; if ( (0 != timeout) && - (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) ) + (timeout < (MHD_monotonic_sec_counter() - connection->last_activity)) ) { MHD_connection_close_ (connection, MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c @@ -155,7 +155,7 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection) } timeout = connection->connection_timeout; if ( (timeout != 0) && - (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity))) + (timeout < (MHD_monotonic_sec_counter() - connection->last_activity))) MHD_connection_close_ (connection, MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); #ifdef EPOLL_SUPPORT