From: Ryan Bloom Date: Tue, 5 Feb 2002 22:18:49 +0000 (+0000) Subject: Remove the install_transport_filters hook. The same function can be X-Git-Tag: 2.0.32~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=862f407872af4dae164f9e48c140b2c21f00d5a7;p=apache Remove the install_transport_filters hook. The same function can be acheived with the pre_connection hook. I have added the socket to the pre_connection phase to make this possible. Reviewed by: Bill Stoddard git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93259 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_connection.h b/include/http_connection.h index d676a9d2f8..120fea7786 100644 --- a/include/http_connection.h +++ b/include/http_connection.h @@ -70,9 +70,12 @@ extern "C" { * This is the protocol module driver. This calls all of the * pre-connection and connection hooks for all protocol modules. * @param c The connection on which the request is read - * @deffunc void ap_process_connection(conn_rec *) + * @param csd The mechanism on which this connection is to be read. + * Most times this will be a socket, but it is up to the module + * that accepts the request to determine the exact type. + * @deffunc void ap_process_connection(conn_rec *c, void *csd) */ -AP_CORE_DECLARE(void) ap_process_connection(conn_rec *, apr_socket_t *csd); +AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd); AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c); @@ -113,27 +116,18 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c); AP_DECLARE_HOOK(conn_rec *, create_connection, (apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh)) -/** - * install_transport_filters is a RUN_FIRST hook used to install the bottom - * most input and output network transport filters (e.g., CORE_IN and CORE_OUT) - * used to interface to the network. This hook can access vhost configuration. - * - * @param c The socket to the client - * @param csd Pointer to the client apr_socket_t struct. - * @return OK or DECLINED - * @deffunc int ap_run_install_transport_filters(conn_rec *c, apr_socket_t *csd) - */ -AP_DECLARE_HOOK(int, install_transport_filters, (conn_rec *c, apr_socket_t *csd)) - /** * This hook gives protocol modules an opportunity to set everything up * before calling the protocol handler. All pre-connection hooks are * run until one returns something other than ok or decline * @param c The connection on which the request has been received. + * @param csd The mechanism on which this connection is to be read. + * Most times this will be a socket, but it is up to the module + * that accepts the request to determine the exact type. * @return OK or DECLINED - * @deffunc int ap_run_pre_connection(conn_rec *c) + * @deffunc int ap_run_pre_connection(conn_rec *c, void *csd) */ -AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c)) +AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c, void *csd)) /** * This hook implements different protocols. After a connection has been diff --git a/modules/experimental/mod_example.c b/modules/experimental/mod_example.c index a42926bfa3..761335e8c4 100644 --- a/modules/experimental/mod_example.c +++ b/modules/experimental/mod_example.c @@ -1028,7 +1028,7 @@ static int x_quick_handler(request_rec *r) * server will still call any remaining modules with an handler for this * phase. */ -static int x_pre_connection(conn_rec *c) +static int x_pre_connection(conn_rec *c, void *csd) { x_cfg *cfg; diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 488988dab9..33faf65aa7 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -1044,7 +1044,7 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, */ /* set up the connection filters */ - ap_run_install_transport_filters(origin, sock); + ap_run_pre_connection(origin, sock); /* possible results: */ /* 120 Service ready in nnn minutes. */ @@ -1786,7 +1786,7 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf, } /* set up the connection filters */ - ap_run_install_transport_filters(data, data_sock); + ap_run_pre_connection(data, data_sock); /* * VI: Receive the Response ------------------------ diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index b8eec52fc3..aaf7817782 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -450,7 +450,7 @@ apr_status_t ap_proxy_http_create_connection(apr_pool_t *p, request_rec *r, p_conn->addr, p_conn->name); /* set up the connection filters */ - ap_run_install_transport_filters(*origin, p_conn->sock); + ap_run_pre_connection(*origin, p_conn->sock); } return OK; } diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index 4a7082469d..0f777a6083 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -219,7 +219,7 @@ static int ssl_hook_pre_config( return OK; } -static int ssl_hook_pre_connection(conn_rec *c) +static int ssl_hook_pre_connection(conn_rec *c, void *csd) { SSLSrvConfigRec *sc = mySrvConfig(c->base_server); SSL *ssl; diff --git a/server/connection.c b/server/connection.c index 48952a2628..20d9d04078 100644 --- a/server/connection.c +++ b/server/connection.c @@ -77,16 +77,13 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(create_connection) APR_HOOK_LINK(process_connection) - APR_HOOK_LINK(install_transport_filters) APR_HOOK_LINK(pre_connection) ) AP_IMPLEMENT_HOOK_RUN_FIRST(conn_rec *,create_connection, (apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh), (p, server, csd, conn_id, sbh), NULL) AP_IMPLEMENT_HOOK_RUN_FIRST(int,process_connection,(conn_rec *c),(c),DECLINED) -AP_IMPLEMENT_HOOK_RUN_FIRST(int, install_transport_filters, - (conn_rec *c, apr_socket_t *csd),(c, csd), DECLINED) -AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED) +AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c, void *csd),(c, csd),OK,DECLINED) /* * More machine-dependent networking gooo... on some systems, * you've got to be *really* sure that all the packets are acknowledged @@ -221,13 +218,11 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c) return; } -AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, apr_socket_t *csd) +AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd) { ap_update_vhost_given_ip(c); - ap_run_install_transport_filters(c, csd); - - ap_run_pre_connection(c); + ap_run_pre_connection(c, csd); if (!c->aborted) { ap_run_process_connection(c); diff --git a/server/core.c b/server/core.c index 4adfae074f..844900a361 100644 --- a/server/core.c +++ b/server/core.c @@ -3651,7 +3651,7 @@ static conn_rec *core_create_conn(apr_pool_t *ptrans, server_rec *server, c->id = id; return c; } -static int core_install_transport_filters(conn_rec *c, apr_socket_t *csd) +static int core_pre_connection(conn_rec *c, void *csd) { core_net_rec *net = apr_palloc(c->pool, sizeof(*net)); @@ -3671,17 +3671,18 @@ static int core_install_transport_filters(conn_rec *c, apr_socket_t *csd) ap_set_module_config(net->c->conn_config, &core_module, csd); ap_add_input_filter("CORE_IN", net, NULL, net->c); ap_add_output_filter("CORE", net, NULL, net->c); - return OK; + return DONE; } static void register_hooks(apr_pool_t *p) { - /* create_connection and install_transport_filters are RUN_FIRST + /* create_connection and install_transport_filters are * hooks that should always be APR_HOOK_REALLY_LAST to give other * modules the opportunity to install alternate network transports + * and stop other functions from being run. */ ap_hook_create_connection(core_create_conn, NULL, NULL, APR_HOOK_REALLY_LAST); - ap_hook_install_transport_filters(core_install_transport_filters, NULL, + ap_hook_pre_connection(core_pre_connection, NULL, NULL, APR_HOOK_REALLY_LAST); ap_hook_post_config(core_post_config,NULL,NULL,APR_HOOK_REALLY_FIRST); diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index d0dee44dce..225b27332c 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -1726,7 +1726,7 @@ static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, return APR_SUCCESS; } -static int perchild_pre_connection(conn_rec *c) +static int perchild_pre_connection(conn_rec *c, void *csd) { ap_add_input_filter("PERCHILD_BUFFER", NULL, NULL, c); return OK; diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index d0dee44dce..225b27332c 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -1726,7 +1726,7 @@ static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, return APR_SUCCESS; } -static int perchild_pre_connection(conn_rec *c) +static int perchild_pre_connection(conn_rec *c, void *csd) { ap_add_input_filter("PERCHILD_BUFFER", NULL, NULL, c); return OK;