diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 8a9df765..b92d5534 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1803,7 +1803,7 @@ thread_main_handle_connection (void *data) | |||
1803 | while ( (! daemon->shutdown) && | 1803 | while ( (! daemon->shutdown) && |
1804 | (MHD_CONNECTION_CLOSED != con->state) ) | 1804 | (MHD_CONNECTION_CLOSED != con->state) ) |
1805 | { | 1805 | { |
1806 | const unsigned int timeout = daemon->connection_timeout; | 1806 | const time_t timeout = daemon->connection_timeout; |
1807 | #ifdef UPGRADE_SUPPORT | 1807 | #ifdef UPGRADE_SUPPORT |
1808 | struct MHD_UpgradeResponseHandle * const urh = con->urh; | 1808 | struct MHD_UpgradeResponseHandle * const urh = con->urh; |
1809 | #else /* ! UPGRADE_SUPPORT */ | 1809 | #else /* ! UPGRADE_SUPPORT */ |
@@ -3276,7 +3276,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
3276 | if (0 != pos->connection_timeout) | 3276 | if (0 != pos->connection_timeout) |
3277 | { | 3277 | { |
3278 | if ( (! have_timeout) || | 3278 | if ( (! have_timeout) || |
3279 | (earliest_deadline > pos->last_activity + pos->connection_timeout) ) | 3279 | (earliest_deadline - pos->last_activity > pos->connection_timeout) ) |
3280 | earliest_deadline = pos->last_activity + pos->connection_timeout; | 3280 | earliest_deadline = pos->last_activity + pos->connection_timeout; |
3281 | have_timeout = true; | 3281 | have_timeout = true; |
3282 | } | 3282 | } |
@@ -3287,7 +3287,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
3287 | (0 != pos->connection_timeout) ) | 3287 | (0 != pos->connection_timeout) ) |
3288 | { | 3288 | { |
3289 | if ( (! have_timeout) || | 3289 | if ( (! have_timeout) || |
3290 | (earliest_deadline > pos->last_activity + pos->connection_timeout) ) | 3290 | (earliest_deadline - pos->connection_timeout > pos->last_activity) ) |
3291 | earliest_deadline = pos->last_activity + pos->connection_timeout; | 3291 | earliest_deadline = pos->last_activity + pos->connection_timeout; |
3292 | have_timeout = true; | 3292 | have_timeout = true; |
3293 | } | 3293 | } |
@@ -4766,6 +4766,7 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
4766 | enum MHD_OPTION opt; | 4766 | enum MHD_OPTION opt; |
4767 | struct MHD_OptionItem *oa; | 4767 | struct MHD_OptionItem *oa; |
4768 | unsigned int i; | 4768 | unsigned int i; |
4769 | unsigned int uv; | ||
4769 | #ifdef HTTPS_SUPPORT | 4770 | #ifdef HTTPS_SUPPORT |
4770 | int ret; | 4771 | int ret; |
4771 | const char *pstr; | 4772 | const char *pstr; |
@@ -4788,8 +4789,18 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
4788 | unsigned int); | 4789 | unsigned int); |
4789 | break; | 4790 | break; |
4790 | case MHD_OPTION_CONNECTION_TIMEOUT: | 4791 | case MHD_OPTION_CONNECTION_TIMEOUT: |
4791 | daemon->connection_timeout = va_arg (ap, | 4792 | uv = va_arg (ap, |
4792 | unsigned int); | 4793 | unsigned int); |
4794 | if (TIME_T_MAX < uv) | ||
4795 | { | ||
4796 | #ifdef HAVE_MESSAGES | ||
4797 | MHD_DLOG (daemon, | ||
4798 | _("Warning: Too large timeout value, ignored.\n")); | ||
4799 | #endif | ||
4800 | daemon->connection_timeout = 0; | ||
4801 | } | ||
4802 | else | ||
4803 | daemon->connection_timeout = (time_t)uv; | ||
4793 | break; | 4804 | break; |
4794 | case MHD_OPTION_NOTIFY_COMPLETED: | 4805 | case MHD_OPTION_NOTIFY_COMPLETED: |
4795 | daemon->notify_completed = va_arg (ap, | 4806 | daemon->notify_completed = va_arg (ap, |