From e01f995ce3dc554cfe5840a89c98fe8161994366 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Thu, 10 Oct 2019 03:34:46 -0400 Subject: [PATCH] [core] run config_setup_connection() fewer times config_setup_connection() is run when con struct is init'd and in connection_reset(), after each request is processed. It also must be called upon HANDLER_COMEBACK when the request needs to be re-parsed, but it need not be run twice in common scenario without HANDLER_COMEBACK --- src/connections.c | 3 +++ src/response.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/connections.c b/src/connections.c index 3e608610..2d1ba5e9 100644 --- a/src/connections.c +++ b/src/connections.c @@ -1222,6 +1222,9 @@ static int connection_handle_request(server *srv, connection *con) { connection_fdwaitqueue_append(srv, con); break; case HANDLER_COMEBACK: + if (con->mode == DIRECT && buffer_is_empty(con->physical.path)) { + config_setup_connection(srv, con); + } return 1; case HANDLER_ERROR: /* something went wrong */ diff --git a/src/response.c b/src/response.c index 166f2f5c..4a2f0ab8 100644 --- a/src/response.c +++ b/src/response.c @@ -306,7 +306,6 @@ handler_t http_response_prepare(server *srv, connection *con) { if (!con->async_callback) { config_cond_cache_reset(srv, con); - config_setup_connection(srv, con); /* Perhaps this could be removed at other places. */ if (con->conf.log_condition_handling) { log_error_write(srv, __FILE__, __LINE__, "s", "run condition");