UWS_HTTP_MAX_HEADERS_SIZE config

This commit is contained in:
uNetworkingAB
2023-12-15 21:47:05 +01:00
committed by GitHub
parent b2ea51bb2f
commit d948b51990
+8 -2
View File
@@ -41,6 +41,14 @@ namespace uWS {
static const unsigned int MINIMUM_HTTP_POST_PADDING = 32;
static void *FULLPTR = (void *)~(uintptr_t)0;
/* STL needs one of these */
template <typename T>
std::optional<T *> optional_ptr(T *ptr) {
return ptr ? std::optional<T *>(ptr) : std::nullopt;
}
static const size_t MAX_FALLBACK_SIZE = (size_t) atoi(optional_ptr(getenv("UWS_HTTP_MAX_HEADERS_SIZE")).value_or((char *) "4096"));
struct HttpRequest {
friend struct HttpParser;
@@ -172,8 +180,6 @@ private:
/* This guy really has only 30 bits since we reserve two highest bits to chunked encoding parsing state */
unsigned int remainingStreamingBytes = 0;
const size_t MAX_FALLBACK_SIZE = 1024 * 4;
/* Returns UINT_MAX on error. Maximum 999999999 is allowed. */
static unsigned int toUnsignedInteger(std::string_view str) {
/* We assume at least 32-bit integer giving us safely 999999999 (9 number of 9s) */