[core] short-circuit path to clear request.headers
short-circuit path to clear con->request.headers if entire size of all request headers is <= BUFFER_MAX_REUSE_SIZE clear (reset) data_string key and value upon reusepersonal/stbuehler/ci-build
parent
5d9bfc9a76
commit
db5ff222e4
|
@ -77,8 +77,6 @@ void array_reset_data_strings(array * const a) {
|
|||
/*force_assert(ds->type == TYPE_STRING);*/
|
||||
buffer * const k = ds->key;
|
||||
buffer * const v = ds->value;
|
||||
buffer_clear(k);
|
||||
buffer_clear(v);
|
||||
if (k->size > BUFFER_MAX_REUSE_SIZE) buffer_reset(k);
|
||||
if (v->size > BUFFER_MAX_REUSE_SIZE) buffer_reset(v);
|
||||
}
|
||||
|
@ -264,6 +262,7 @@ int * array_get_int_ptr(array * const a, const char * const k, const size_t klen
|
|||
|
||||
data_integer * const di =array_insert_integer_at_pos(a,(uint32_t)(-ipos-1));
|
||||
buffer_copy_string_len(di->key, k, klen);
|
||||
di->value = 0;
|
||||
return &di->value;
|
||||
}
|
||||
|
||||
|
@ -273,11 +272,13 @@ buffer * array_get_buf_ptr(array * const a, const char * const k, const size_t k
|
|||
|
||||
data_string * const ds = array_insert_string_at_pos(a, (uint32_t)(-ipos-1));
|
||||
buffer_copy_string_len(ds->key, k, klen);
|
||||
buffer_clear(ds->value);
|
||||
return ds->value;
|
||||
}
|
||||
|
||||
void array_insert_value(array * const a, const char * const v, const size_t vlen) {
|
||||
data_string * const ds = array_insert_string_at_pos(a, a->used);
|
||||
buffer_clear(ds->key);
|
||||
buffer_copy_string_len(ds->value, v, vlen);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "base.h"
|
||||
#include "buffer.h"
|
||||
#include "burl.h" /* HTTP_PARSEOPT_HEADER_STRICT */
|
||||
#include "settings.h" /* BUFFER_MAX_REUSE_SIZE */
|
||||
#include "log.h"
|
||||
#include "connections.h"
|
||||
#include "fdevent.h"
|
||||
|
@ -678,15 +679,19 @@ static int connection_reset(server *srv, connection *con) {
|
|||
con->request.te_chunked = 0;
|
||||
con->request.htags = 0;
|
||||
|
||||
array_reset_data_strings(con->request.headers);
|
||||
array_reset_data_strings(con->environment);
|
||||
if (con->header_len <= BUFFER_MAX_REUSE_SIZE)
|
||||
con->request.headers->used = 0;
|
||||
else
|
||||
array_reset_data_strings(con->request.headers);
|
||||
con->header_len = 0;
|
||||
if (0 != con->environment->used)
|
||||
array_reset_data_strings(con->environment);
|
||||
|
||||
chunkqueue_reset(con->request_content_queue);
|
||||
|
||||
/* The cond_cache gets reset in response.c */
|
||||
/* config_cond_cache_reset(srv, con); */
|
||||
|
||||
con->header_len = 0;
|
||||
con->async_callback = 0;
|
||||
con->error_handler_saved_status = 0;
|
||||
/*con->error_handler_saved_method = HTTP_METHOD_UNSET;*/
|
||||
|
|
Loading…
Reference in New Issue