[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/05: Reduced maximum possible connection timeout
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/05: Reduced maximum possible connection timeout |
Date: |
Sun, 26 Dec 2021 10:43:04 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 430d7251faa8f3eb28a6f58856235f2a6305da1b
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Dec 26 11:56:43 2021 +0300
Reduced maximum possible connection timeout
The maximum timeout value is still too large to be used (more than
hundred thousand years).
---
src/microhttpd/connection.c | 10 +++++-----
src/microhttpd/daemon.c | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 79014352..02fc0e71 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4999,8 +4999,8 @@ MHD_set_connection_option (struct MHD_Connection
*connection,
va_start (ap, option);
ui_val = va_arg (ap, unsigned int);
va_end (ap);
-#if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT
- if ((UINT64_MAX / 2000 - 1) < ui_val)
+#if (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT
+ if ((UINT64_MAX / 4000 - 1) < ui_val)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
@@ -5008,12 +5008,12 @@ MHD_set_connection_option (struct MHD_Connection
*connection,
"large. Maximum allowed value (%" PRIu64 ") will be used " \
"instead.\n"),
ui_val,
- (UINT64_MAX / 2000 - 1));
+ (UINT64_MAX / 4000 - 1));
#endif
- ui_val = UINT64_MAX / 2000 - 1;
+ ui_val = UINT64_MAX / 4000 - 1;
}
else
-#endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */
+#endif /* (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT */
connection->connection_timeout_ms = ui_val * 1000;
if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! connection->suspended) )
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 9f220263..d4064dd7 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5658,8 +5658,8 @@ parse_options_va (struct MHD_Daemon *daemon,
case MHD_OPTION_CONNECTION_TIMEOUT:
uv = va_arg (ap,
unsigned int);
-#if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT
- if ((UINT64_MAX / 2000 - 1) < uv)
+#if (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT
+ if ((UINT64_MAX / 4000 - 1) < uv)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
@@ -5667,11 +5667,11 @@ parse_options_va (struct MHD_Daemon *daemon,
"Maximum allowed value (%" PRIu64 ") will be used " \
"instead.\n"),
uv,
- (UINT64_MAX / 2000 - 1));
+ (UINT64_MAX / 4000 - 1));
#endif
- uv = UINT64_MAX / 2000 - 1;
+ uv = UINT64_MAX / 4000 - 1;
}
-#endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */
+#endif /* (SIZEOF_UINT64_T - 2) <= SIZEOF_UNSIGNED_INT */
daemon->connection_timeout_ms = uv * 1000;
break;
case MHD_OPTION_NOTIFY_COMPLETED:
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.