From 44bcfd633a88bbcd7ba7851b7a2fca5651453735 Mon Sep 17 00:00:00 2001 From: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com> Date: Fri, 15 Dec 2023 20:52:00 +0100 Subject: [PATCH] Fix it --- src/HttpParser.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/HttpParser.h b/src/HttpParser.h index 412f6289b..3983cb97f 100644 --- a/src/HttpParser.h +++ b/src/HttpParser.h @@ -41,7 +41,13 @@ namespace uWS { static const unsigned int MINIMUM_HTTP_POST_PADDING = 32; static void *FULLPTR = (void *)~(uintptr_t)0; -static const size_t MAX_FALLBACK_SIZE = std::max((size_t) atoi(getenv("UWS_HTTP_MAX_HEADERS_SIZE")), 1024 * 4); +/* STL needs one of these */ +template +std::optional maybeify(T *ptr) { + return ptr ? ptr : std::nullopt; +} + +static const size_t MAX_FALLBACK_SIZE = atoi(maybeify(getenv("UWS_HTTP_MAX_HEADERS_SIZE")).value_or("4096")); struct HttpRequest {