Add UWS_HTTP_MAX_HEADERS_COUNT, raise default
This commit is contained in:
committed by
Alex Hultman
parent
d948b51990
commit
85c6f0fb69
+5
-3
@@ -48,16 +48,18 @@ std::optional<T *> optional_ptr(T *ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const size_t MAX_FALLBACK_SIZE = (size_t) atoi(optional_ptr(getenv("UWS_HTTP_MAX_HEADERS_SIZE")).value_or((char *) "4096"));
|
static const size_t MAX_FALLBACK_SIZE = (size_t) atoi(optional_ptr(getenv("UWS_HTTP_MAX_HEADERS_SIZE")).value_or((char *) "4096"));
|
||||||
|
#ifndef UWS_HTTP_MAX_HEADERS_COUNT
|
||||||
|
#define UWS_HTTP_MAX_HEADERS_COUNT 100
|
||||||
|
#endif
|
||||||
|
|
||||||
struct HttpRequest {
|
struct HttpRequest {
|
||||||
|
|
||||||
friend struct HttpParser;
|
friend struct HttpParser;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const static int MAX_HEADERS = 50;
|
|
||||||
struct Header {
|
struct Header {
|
||||||
std::string_view key, value;
|
std::string_view key, value;
|
||||||
} headers[MAX_HEADERS];
|
} headers[UWS_HTTP_MAX_HEADERS_COUNT];
|
||||||
bool ancientHttp;
|
bool ancientHttp;
|
||||||
unsigned int querySeparator;
|
unsigned int querySeparator;
|
||||||
bool didYield;
|
bool didYield;
|
||||||
@@ -327,7 +329,7 @@ private:
|
|||||||
}
|
}
|
||||||
headers++;
|
headers++;
|
||||||
|
|
||||||
for (unsigned int i = 1; i < HttpRequest::MAX_HEADERS - 1; i++) {
|
for (unsigned int i = 1; i < UWS_HTTP_MAX_HEADERS_COUNT - 1; i++) {
|
||||||
/* Lower case and consume the field name */
|
/* Lower case and consume the field name */
|
||||||
preliminaryKey = postPaddedBuffer;
|
preliminaryKey = postPaddedBuffer;
|
||||||
postPaddedBuffer = (char *) consumeFieldName(postPaddedBuffer);
|
postPaddedBuffer = (char *) consumeFieldName(postPaddedBuffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user