From ba047efee0066c395aed149dc6855e4f3079fd27 Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Mon, 2 Oct 2000 19:52:37 +0000 Subject: [PATCH] Move where the CORE_IN filter is added to the server. We used to do this in ap_new_connection, but that is bogus, because then other modules can't put their own filter in. Now, we do this in a new pre-connection hook function. Later, we will want to add some checking to make sure that this is really an HTTP request that we are adding the filter for. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86364 13f79535-47bb-0310-9956-ffa450edef68 --- include/http_connection.h | 10 +++++++++- modules/http/http_core.c | 2 ++ server/connection.c | 8 ++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/http_connection.h b/include/http_connection.h index 2b204bd6fc..22415a08d9 100644 --- a/include/http_connection.h +++ b/include/http_connection.h @@ -101,7 +101,15 @@ conn_rec *ap_new_apr_connection(apr_pool_t *p, server_rec *server, BUFF *inout, CORE_EXPORT(void) ap_process_connection(conn_rec *); /** - * The http protocol handler. This makes Apache server http requests + * The http pre-protocol handler. This makes sets up Apache to serve http + * requests + * @param c The connection on which the request is read + * @return OK or DECLINED + */ +int ap_pre_http_connection(conn_rec *); + +/** + * The http protocol handler. This makes Apache serve http requests * @param c The connection on which the request is read * @return OK or DECLINED */ diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 2709fd6ee9..eb493ca759 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -3467,6 +3467,8 @@ static void register_hooks(void) { ap_hook_post_config(core_post_config,NULL,NULL,AP_HOOK_REALLY_FIRST); ap_hook_translate_name(ap_core_translate,NULL,NULL,AP_HOOK_REALLY_LAST); + ap_hook_pre_connection(ap_pre_http_connection,NULL,NULL, + AP_HOOK_REALLY_LAST); ap_hook_process_connection(ap_process_http_connection,NULL,NULL, AP_HOOK_REALLY_LAST); ap_hook_http_method(core_method,NULL,NULL,AP_HOOK_REALLY_LAST); diff --git a/server/connection.c b/server/connection.c index d36ff7064d..9b1e04942e 100644 --- a/server/connection.c +++ b/server/connection.c @@ -214,6 +214,12 @@ CORE_EXPORT(void) ap_process_connection(conn_rec *c) } +int ap_pre_http_connection(conn_rec *c) +{ + ap_add_input_filter("CORE_IN", NULL, c); + return OK; +} + int ap_process_http_connection(conn_rec *c) { request_rec *r; @@ -276,8 +282,6 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server, BUFF *inout, conn->id = id; - ap_add_input_filter("CORE_IN", NULL, conn); - return conn; } -- 2.40.0