Skip to content

Commit 44bcfd6

Browse files
Fix it
1 parent 75a5256 commit 44bcfd6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/HttpParser.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ namespace uWS {
4141
static const unsigned int MINIMUM_HTTP_POST_PADDING = 32;
4242
static void *FULLPTR = (void *)~(uintptr_t)0;
4343

44-
static const size_t MAX_FALLBACK_SIZE = std::max<size_t>((size_t) atoi(getenv("UWS_HTTP_MAX_HEADERS_SIZE")), 1024 * 4);
44+
/* STL needs one of these */
45+
template<typename T>
46+
std::optional<T> maybeify(T *ptr) {
47+
return ptr ? ptr : std::nullopt;
48+
}
49+
50+
static const size_t MAX_FALLBACK_SIZE = atoi(maybeify(getenv("UWS_HTTP_MAX_HEADERS_SIZE")).value_or("4096"));
4551

4652
struct HttpRequest {
4753

0 commit comments

Comments
 (0)