mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
add max_http_header_data2 and upgrade internal offsets from short to int
https://github.com/warmcat/libwebsockets/issues/550 Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
eda447e74a
commit
4889566d5d
4 changed files with 15 additions and 6 deletions
|
@ -643,7 +643,11 @@ lws_create_context(struct lws_context_creation_info *info)
|
|||
if (info->max_http_header_data)
|
||||
context->max_http_header_data = info->max_http_header_data;
|
||||
else
|
||||
context->max_http_header_data = LWS_DEF_HEADER_LEN;
|
||||
if (info->max_http_header_data2)
|
||||
context->max_http_header_data =
|
||||
info->max_http_header_data2;
|
||||
else
|
||||
context->max_http_header_data = LWS_DEF_HEADER_LEN;
|
||||
if (info->max_http_header_pool)
|
||||
context->max_http_header_pool = info->max_http_header_pool;
|
||||
else
|
||||
|
|
|
@ -1501,6 +1501,10 @@ struct lws_http_mount {
|
|||
* defines the max chunk of file that can be sent at once.
|
||||
* At the risk of lws having to buffer failed large sends, it
|
||||
* can be increased to, eg, 128KiB to improve throughput.
|
||||
* @max_http_header_data2 CONTEXT: if @max_http_header_data 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.
|
||||
*/
|
||||
|
||||
struct lws_context_creation_info {
|
||||
|
@ -1544,6 +1548,7 @@ struct lws_context_creation_info {
|
|||
const struct lws_http_mount *mounts; /* VH */
|
||||
const char *server_string; /* context */
|
||||
unsigned int pt_serv_buf_size; /* context */
|
||||
unsigned int max_http_header_data2; /* context */
|
||||
|
||||
/* Add new things just above here ---^
|
||||
* This is part of the ABI, don't needlessly break compatibility
|
||||
|
|
|
@ -460,7 +460,7 @@ char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)
|
|||
int LWS_WARN_UNUSED_RESULT
|
||||
lws_pos_in_bounds(struct lws *wsi)
|
||||
{
|
||||
if (wsi->u.hdr.ah->pos < wsi->context->max_http_header_data)
|
||||
if (wsi->u.hdr.ah->pos < (unsigned int)wsi->context->max_http_header_data)
|
||||
return 0;
|
||||
|
||||
if (wsi->u.hdr.ah->pos == wsi->context->max_http_header_data) {
|
||||
|
|
|
@ -520,7 +520,7 @@ struct lws_fd_hashtable {
|
|||
*/
|
||||
|
||||
struct lws_fragments {
|
||||
unsigned short offset;
|
||||
unsigned int offset;
|
||||
unsigned short len;
|
||||
unsigned char nfrag; /* which ah->frag[] continues this content, or 0 */
|
||||
};
|
||||
|
@ -548,12 +548,12 @@ struct allocated_headers {
|
|||
unsigned char rx[2048];
|
||||
unsigned int rxpos;
|
||||
unsigned int rxlen;
|
||||
unsigned int pos;
|
||||
|
||||
#ifndef LWS_NO_CLIENT
|
||||
char initial_handshake_hash_base64[30];
|
||||
#endif
|
||||
|
||||
unsigned short pos;
|
||||
unsigned char in_use;
|
||||
unsigned char nfrag;
|
||||
};
|
||||
|
@ -742,6 +742,7 @@ struct lws_context {
|
|||
unsigned int fd_limit_per_thread;
|
||||
unsigned int timeout_secs;
|
||||
unsigned int pt_serv_buf_size;
|
||||
int max_http_header_data;
|
||||
|
||||
/*
|
||||
* set to the Thread ID that's doing the service loop just before entry
|
||||
|
@ -752,7 +753,6 @@ struct lws_context {
|
|||
volatile int service_tid;
|
||||
int service_tid_detected;
|
||||
|
||||
short max_http_header_data;
|
||||
short max_http_header_pool;
|
||||
short count_threads;
|
||||
short plugin_protocol_count;
|
||||
|
@ -906,7 +906,7 @@ struct _lws_header_related {
|
|||
enum uri_path_states ups;
|
||||
enum uri_esc_states ues;
|
||||
short lextable_pos;
|
||||
unsigned short current_token_limit;
|
||||
unsigned int current_token_limit;
|
||||
#ifndef LWS_NO_CLIENT
|
||||
unsigned short c_port;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue