diff options
author | Ruediger Pluem <rpluem@apache.org> | 2021-09-21 22:03:52 +0200 |
---|---|---|
committer | Ruediger Pluem <rpluem@apache.org> | 2021-09-21 22:03:52 +0200 |
commit | 6d9a8cd1f243d9f6df4481f5ec19ec0d96109654 (patch) | |
tree | f9b03537abb7d19e268986bb98fdee84ce38f421 /server/core.c | |
parent | No nullglob with ls.. (diff) | |
download | apache2-6d9a8cd1f243d9f6df4481f5ec19ec0d96109654.tar.xz apache2-6d9a8cd1f243d9f6df4481f5ec19ec0d96109654.zip |
In case one of the pre_connection hooks causes the hook run to stop by an error
the pre_connection hook of the core module maybe did not run
(it is APR_HOOK_REALLY_LAST) and hence we missed to
- Put the socket in c->conn_config
- Setup core output and input filters
- Set socket options and timeouts
For calls of ap_run_pre_connection where this matters create a wrapper named
ap_pre_connection that ensures that this happens.
* include/ap_mmn.h: Bump minor version as we added new ap_pre_connection
function.
* include/http_connection.h: Declare ap_pre_connection prototype.
* server/connection.c: Make use of ap_pre_connection in ap_process_connection.
* server/core.c: Implement ap_pre_connection.
* server/mpm/event/event.c: Make use of ap_pre_connection.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893497 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/core.c')
-rw-r--r-- | server/core.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/server/core.c b/server/core.c index 4d777b9b8e..67c36f8134 100644 --- a/server/core.c +++ b/server/core.c @@ -5557,6 +5557,31 @@ static int core_pre_connection(conn_rec *c, void *csd) return DONE; } +AP_DECLARE(int) ap_pre_connection(conn_rec *c, void *csd) +{ + int rc = OK; + + rc = ap_run_pre_connection(c, csd); + if (rc != OK && rc != DONE) { + c->aborted = 1; + /* + * In case we errored, the pre_connection hook of the core + * module maybe did not run (it is APR_HOOK_REALLY_LAST) and + * hence we missed to + * + * - Put the socket in c->conn_config + * - Setup core output and input filters + * - Set socket options and timeouts + * + * Hence call it in this case. + */ + if (!ap_get_conn_socket(c)) { + core_pre_connection(c, csd); + } + } + return rc; +} + AP_CORE_DECLARE(conn_rec *) ap_create_slave_connection(conn_rec *c) { apr_pool_t *pool; |