diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-11-18 19:18:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-11-18 19:18:24 +0000 |
commit | 7c75a906a6adec1653d9e6e90c30de24f0fe6d31 (patch) | |
tree | 05b2f95b1d8ac120dba5b145f5e004faf1347221 | |
parent | 841845233e6b31d017077ff70111c4049076bd27 (diff) | |
download | libmicrohttpd-7c75a906a6adec1653d9e6e90c30de24f0fe6d31.tar.gz libmicrohttpd-7c75a906a6adec1653d9e6e90c30de24f0fe6d31.zip |
fixing 1914
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/daemon/daemon.c | 18 |
2 files changed, 15 insertions, 7 deletions
@@ -1,3 +1,7 @@ | |||
1 | Fri Nov 18 20:17:22 CET 2011 | ||
2 | Fixing return value of MHD_get_timeout if timeouts are not in use. | ||
3 | (#1914). -rboulton | ||
4 | |||
1 | Sun Nov 13 13:34:29 CET 2011 | 5 | Sun Nov 13 13:34:29 CET 2011 |
2 | Trying to fix accidental addition of a "Connection: close" footer | 6 | Trying to fix accidental addition of a "Connection: close" footer |
3 | under certain (rare) circumstances. -CG | 7 | under certain (rare) circumstances. -CG |
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 2b8eac5f..47c7c527 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -1204,6 +1204,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
1204 | time_t earliest_deadline; | 1204 | time_t earliest_deadline; |
1205 | time_t now; | 1205 | time_t now; |
1206 | struct MHD_Connection *pos; | 1206 | struct MHD_Connection *pos; |
1207 | int have_timeout = MHD_NO; | ||
1207 | 1208 | ||
1208 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 1209 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) |
1209 | { | 1210 | { |
@@ -1215,19 +1216,22 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
1215 | pos = daemon->connections_head; | 1216 | pos = daemon->connections_head; |
1216 | if (pos == NULL) | 1217 | if (pos == NULL) |
1217 | return MHD_NO; /* no connections */ | 1218 | return MHD_NO; /* no connections */ |
1218 | earliest_deadline = pos->last_activity + pos->connection_timeout; | ||
1219 | pos = pos->next; | ||
1220 | while (pos != NULL) | 1219 | while (pos != NULL) |
1221 | { | 1220 | { |
1222 | if (earliest_deadline > pos->last_activity + pos->connection_timeout) | 1221 | if (0 != pos->connection_timeout) { |
1223 | earliest_deadline = pos->last_activity + pos->connection_timeout; | 1222 | have_timeout = MHD_YES; |
1223 | if (earliest_deadline > pos->last_activity + pos->connection_timeout) | ||
1224 | earliest_deadline = pos->last_activity + pos->connection_timeout; | ||
1224 | #if HTTPS_SUPPORT | 1225 | #if HTTPS_SUPPORT |
1225 | if ( (0 != (daemon->options & MHD_USE_SSL)) && | 1226 | if ( (0 != (daemon->options & MHD_USE_SSL)) && |
1226 | (0 != gnutls_record_check_pending (pos->tls_session)) ) | 1227 | (0 != gnutls_record_check_pending (pos->tls_session)) ) |
1227 | earliest_deadline = 0; | 1228 | earliest_deadline = 0; |
1228 | #endif | 1229 | #endif |
1230 | } | ||
1229 | pos = pos->next; | 1231 | pos = pos->next; |
1230 | } | 1232 | } |
1233 | if (!have_timeout) | ||
1234 | return MHD_NO; | ||
1231 | now = time (NULL); | 1235 | now = time (NULL); |
1232 | if (earliest_deadline < now) | 1236 | if (earliest_deadline < now) |
1233 | *timeout = 0; | 1237 | *timeout = 0; |