diff --git a/lib/core/context.c b/lib/core/context.c index c4acac573..35da6f50e 100644 --- a/lib/core/context.c +++ b/lib/core/context.c @@ -1375,7 +1375,11 @@ lws_create_context(const struct lws_context_creation_info *info) if (info->max_http_header_pool) context->max_http_header_pool = info->max_http_header_pool; else - context->max_http_header_pool = context->max_fds; + if (info->max_http_header_pool2) + context->max_http_header_pool = + info->max_http_header_pool2; + else + context->max_http_header_pool = context->max_fds; if (info->fd_limit_per_thread) context->fd_limit_per_thread = info->fd_limit_per_thread; diff --git a/lib/core/private.h b/lib/core/private.h index bb2b1a175..6766e47d6 100644 --- a/lib/core/private.h +++ b/lib/core/private.h @@ -655,6 +655,7 @@ struct lws_context { unsigned int timeout_secs; unsigned int pt_serv_buf_size; int max_http_header_data; + int max_http_header_pool; int simultaneous_ssl_restriction; int simultaneous_ssl; #if defined(LWS_WITH_PEER_LIMITS) @@ -681,7 +682,6 @@ struct lws_context { volatile int service_tid; int service_tid_detected; - short max_http_header_pool; short count_threads; short plugin_protocol_count; short plugin_extension_count; diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h index 29e91a3e9..0f81d1027 100644 --- a/lib/libwebsockets.h +++ b/lib/libwebsockets.h @@ -2774,10 +2774,10 @@ struct lws_context_creation_info { void *provided_client_ssl_ctx; /**< dummy if ssl disabled */ #endif - short max_http_header_data; + unsigned short max_http_header_data; /**< CONTEXT: The max amount of header payload that can be handled * in an http request (unrecognized header payload is dropped) */ - short max_http_header_pool; + unsigned short max_http_header_pool; /**< CONTEXT: The max number of connections with http headers that * can be processed simultaneously (the corresponding memory is * allocated and deallocated dynamically as needed). If the pool is @@ -2997,6 +2997,11 @@ struct lws_context_creation_info { /**< VHOST: opaque pointer lws ignores but passes to the finalize * callback. If you don't care, leave it NULL. */ + unsigned int max_http_header_pool2; + /**< CONTEXT: if max_http_header_pool is 0 and this + * is nonzero, this will be used in place of the default. It's + * like this for compatibility with the original short version: + * this is unsigned int length. */ /* Add new things just above here ---^ * This is part of the ABI, don't needlessly break compatibility