summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-02-08 09:15:14 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2019-02-08 22:49:46 -0500
commit7f8fd8ad095f7d9e1a2f51c7cc054bd70e607f17 (patch)
tree415eeb51f246defccf47e1e470ca5b31c13d3aa6
parentd7ad5819e6c80170ad03cc790a4f18d4f40e91a4 (diff)
downloadlighttpd1.4-7f8fd8ad095f7d9e1a2f51c7cc054bd70e607f17.tar.gz
lighttpd1.4-7f8fd8ad095f7d9e1a2f51c7cc054bd70e607f17.zip
[core] make parse_request,request.request same buf
-rw-r--r--src/connections.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/connections.c b/src/connections.c
index 4ae98823..b76d2008 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -545,6 +545,7 @@ static connection *connection_init(server *srv) {
con->bytes_read = 0;
con->bytes_header = 0;
con->loops_per_request = 0;
+ con->parse_request = con->request.request; /* for http_request_parse() */
#define CLEAN(x) \
con->x = buffer_init();
@@ -567,7 +568,6 @@ static connection *connection_init(server *srv) {
CLEAN(physical.basedir);
CLEAN(physical.rel_path);
CLEAN(physical.etag);
- CLEAN(parse_request);
CLEAN(server_name);
CLEAN(proto);
@@ -633,7 +633,6 @@ void connections_free(server *srv) {
CLEAN(physical.basedir);
CLEAN(physical.etag);
CLEAN(physical.rel_path);
- CLEAN(parse_request);
CLEAN(server_name);
CLEAN(proto);
@@ -714,7 +713,7 @@ static void connection_read_header(server *srv, connection *con) {
chunk *c;
size_t hlen = 0;
int le = 0;
- buffer *save;
+ buffer *save = NULL;
for (c = cq->first; c; c = c->next) {
size_t clen = buffer_string_length(c->mem) - c->offset;
@@ -794,11 +793,9 @@ static void connection_read_header(server *srv, connection *con) {
buffer_reset(con->uri.query);
buffer_reset(con->request.orig_uri);
- save = con->parse_request;
- con->parse_request = con->request.request; /* for http_request_parse() */
if (srv->srvconf.log_request_header_on_error) {
/* copy request only if we may need to log it upon error */
- buffer_copy_buffer(save, con->request.request);
+ save = buffer_init_buffer(con->request.request);
}
if (0 != http_request_parse(srv, con)) {
@@ -811,8 +808,7 @@ static void connection_read_header(server *srv, connection *con) {
}
}
- con->parse_request = save;
- buffer_reset(save);
+ if (NULL != save) buffer_free(save);
buffer_reset(con->request.request);
connection_set_state(srv, con, CON_STATE_REQUEST_END);