[core] combine duplicated connection reset code

connection_reset() now calls connection_response_reset()
instead of duplicating the code in both routines
personal/stbuehler/mod-csrf
Glenn Strauss 7 years ago
parent 445bc2914a
commit ac9822f468

@ -381,6 +381,7 @@ handler_t connection_handle_read_post_state(server *srv, connection *con) {
void connection_response_reset(server *srv, connection *con) {
UNUSED(srv);
con->mode = DIRECT;
con->http_status = 0;
con->is_writable = 1;
con->file_finished = 0;
@ -390,7 +391,13 @@ void connection_response_reset(server *srv, connection *con) {
con->response.keep_alive = 0;
con->response.content_length = -1;
con->response.transfer_encoding = 0;
buffer_reset(con->physical.path);
if (con->physical.path) { /*(skip for mod_fastcgi authorizer)*/
buffer_reset(con->physical.doc_root);
buffer_reset(con->physical.path);
buffer_reset(con->physical.basedir);
buffer_reset(con->physical.rel_path);
buffer_reset(con->physical.etag);
}
array_reset(con->response.headers);
chunkqueue_reset(con->write_queue);
}

@ -696,14 +696,8 @@ int connection_reset(server *srv, connection *con) {
plugins_call_connection_reset(srv, con);
connection_response_reset(srv, con);
con->is_readable = 1;
con->is_writable = 1;
con->http_status = 0;
con->file_finished = 0;
con->file_started = 0;
con->got_response = 0;
con->parsed_response = 0;
con->bytes_written = 0;
con->bytes_written_cur_second = 0;
@ -717,12 +711,6 @@ int connection_reset(server *srv, connection *con) {
con->request.http_if_modified_since = NULL;
con->request.http_if_none_match = NULL;
con->response.keep_alive = 0;
con->response.content_length = -1;
con->response.transfer_encoding = 0;
con->mode = DIRECT;
#define CLEAN(x) \
if (con->x) buffer_reset(con->x);
@ -739,12 +727,6 @@ int connection_reset(server *srv, connection *con) {
CLEAN(uri.path_raw);
/* CLEAN(uri.query); */
CLEAN(physical.doc_root);
CLEAN(physical.path);
CLEAN(physical.basedir);
CLEAN(physical.rel_path);
CLEAN(physical.etag);
CLEAN(parse_request);
CLEAN(server_name);
@ -768,10 +750,8 @@ int connection_reset(server *srv, connection *con) {
con->request.content_length = 0;
array_reset(con->request.headers);
array_reset(con->response.headers);
array_reset(con->environment);
chunkqueue_reset(con->write_queue);
chunkqueue_reset(con->request_content_queue);
/* the plugins should cleanup themself */

Loading…
Cancel
Save