This patch removes the insert_transport_filters hook, and replaces it
with the pre_connection hook. The were in the same place, with the only
difference being the arguments and one was RUN_FIRST while the other was
RUN_ALL. I solved the first problem by changing the arguments of the
pre_connection phase to match insert_transport_filters. The second
problem is that pre_connection is a RUN_ALL.
This is solved by the module itself. RUN_ALL simply means that the hook
runs all of the functions until one of the functions declares that it is
the last function to run by returning DONE.
I am trying to remove redundant hooks.
Ryan
Index: include/http_connection.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/http_connection.h,v
retrieving revision 1.51
diff -u -d -b -w -u -r1.51 http_connection.h
--- include/http_connection.h 1 Feb 2002 22:16:30 -0000 1.51
+++ include/http_connection.h 5 Feb 2002 20:29:21 -0000
@@ -70,9 +70,12 @@
* 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);
@@ -114,26 +117,17 @@
(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
Index: modules/experimental/mod_example.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_example.c,v
retrieving revision 1.32
diff -u -d -b -w -u -r1.32 mod_example.c
--- modules/experimental/mod_example.c 28 Jan 2002 23:49:39 -0000
1.32
+++ modules/experimental/mod_example.c 5 Feb 2002 20:29:21 -0000
@@ -1028,7 +1028,7 @@
* 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;
Index: modules/proxy/proxy_ftp.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
retrieving revision 1.110
diff -u -d -b -w -u -r1.110 proxy_ftp.c
--- modules/proxy/proxy_ftp.c 4 Feb 2002 10:11:29 -0000 1.110
+++ modules/proxy/proxy_ftp.c 5 Feb 2002 20:29:22 -0000
@@ -1044,7 +1044,7 @@
*/
/* 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 @@
}
/* set up the connection filters */
- ap_run_install_transport_filters(data, data_sock);
+ ap_run_pre_connection(data, data_sock);
/*
* VI: Receive the Response ------------------------
Index: modules/proxy/proxy_http.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
retrieving revision 1.128
diff -u -d -b -w -u -r1.128 proxy_http.c
--- modules/proxy/proxy_http.c 1 Feb 2002 22:16:30 -0000 1.128
+++ modules/proxy/proxy_http.c 5 Feb 2002 20:29:22 -0000
@@ -450,7 +450,7 @@
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;
}
Index: modules/ssl/mod_ssl.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/ssl/mod_ssl.c,v
retrieving revision 1.43
diff -u -d -b -w -u -r1.43 mod_ssl.c
--- modules/ssl/mod_ssl.c 28 Jan 2002 23:49:39 -0000 1.43
+++ modules/ssl/mod_ssl.c 5 Feb 2002 20:29:22 -0000
@@ -219,7 +219,7 @@
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;
Index: server/connection.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/connection.c,v
retrieving revision 1.99
diff -u -d -b -w -u -r1.99 connection.c
--- server/connection.c 1 Feb 2002 22:16:30 -0000 1.99
+++ server/connection.c 5 Feb 2002 20:29:22 -0000
@@ -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 @@
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);
Index: server/core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/core.c,v
retrieving revision 1.142
diff -u -d -b -w -u -r1.142 core.c
--- server/core.c 1 Feb 2002 22:16:30 -0000 1.142
+++ server/core.c 5 Feb 2002 20:29:29 -0000
@@ -3651,7 +3651,7 @@
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 @@
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);
Index: server/mpm/perchild/perchild.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v
retrieving revision 1.107
diff -u -d -b -w -u -r1.107 perchild.c
--- server/mpm/perchild/perchild.c 4 Feb 2002 18:41:46 -0000
1.107
+++ server/mpm/perchild/perchild.c 5 Feb 2002 20:29:29 -0000
@@ -1726,7 +1726,7 @@
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;
----------------------------------------------
Ryan Bloom [EMAIL PROTECTED]
645 Howard St. [EMAIL PROTECTED]
San Francisco, CA