diff options
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | docs/manual/developer/new_api_2_4.xml | 3 | ||||
-rw-r--r-- | include/ap_mmn.h | 3 | ||||
-rw-r--r-- | include/http_core.h | 7 | ||||
-rw-r--r-- | modules/echo/mod_echo.c | 2 | ||||
-rw-r--r-- | modules/experimental/mod_noloris.c | 2 | ||||
-rw-r--r-- | modules/filters/mod_reqtimeout.c | 2 | ||||
-rw-r--r-- | modules/http/http_core.c | 2 | ||||
-rw-r--r-- | modules/proxy/mod_proxy_connect.c | 2 | ||||
-rw-r--r-- | modules/proxy/mod_proxy_fdpass.c | 4 | ||||
-rw-r--r-- | server/connection.c | 2 | ||||
-rw-r--r-- | server/core.c | 5 | ||||
-rw-r--r-- | server/protocol.c | 2 |
13 files changed, 28 insertions, 11 deletions
@@ -2,6 +2,9 @@ Changes with Apache 2.3.13 + *) core: Introduce new function ap_get_conn_socket() to access the socket of + a connection. [Stefan Fritsch] + *) mod_data: Introduce a filter to support RFC2397 data URLs. [Graham Leggett] diff --git a/docs/manual/developer/new_api_2_4.xml b/docs/manual/developer/new_api_2_4.xml index b3bdf13bd4..6bce75589f 100644 --- a/docs/manual/developer/new_api_2_4.xml +++ b/docs/manual/developer/new_api_2_4.xml @@ -118,6 +118,9 @@ initial configuration preflight phase or not. This is both easier to use and more correct than the old method of creating a pool userdata entry in the process pool.</li> + <li>New function ap_get_conn_socket to get the socket descriptor for a + connection. This should be used instead of accessing the core + connection config directly.</li> </ul> </section> diff --git a/include/ap_mmn.h b/include/ap_mmn.h index be41daea7e..b7f927ca26 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -332,6 +332,7 @@ * context_document_root, context_prefix. * Add ap_context_*(), ap_set_context_info(), ap_set_document_root() * 20110605.1 (2.3.13-dev) add ap_(get|set)_core_module_config() + * 20110605.2 (2.3.13-dev) add ap_get_conn_socket() */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ @@ -339,7 +340,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20110605 #endif -#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/http_core.h b/include/http_core.h index b64e0b2986..f3644ad8ab 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -336,6 +336,13 @@ AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv); */ AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val); +/** Get the socket from the core network filter. This should be used instead of + * accessing the core connection config directly. + * @param c The connection record + * @return The socket + */ +AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c); + #ifndef AP_DEBUG #define AP_CORE_MODULE_INDEX 0 #define ap_get_core_module_config(v) \ diff --git a/modules/echo/mod_echo.c b/modules/echo/mod_echo.c index 7d21fd5b1c..c595496b47 100644 --- a/modules/echo/mod_echo.c +++ b/modules/echo/mod_echo.c @@ -168,7 +168,7 @@ static int process_echo_connection(conn_rec *c) } if (!csd) { - csd = ap_get_core_module_config(c->conn_config); + csd = ap_get_conn_socket(c); apr_socket_timeout_set(csd, c->base_server->keep_alive_timeout); } diff --git a/modules/experimental/mod_noloris.c b/modules/experimental/mod_noloris.c index f2abeef32b..cfc217e1ea 100644 --- a/modules/experimental/mod_noloris.c +++ b/modules/experimental/mod_noloris.c @@ -68,7 +68,7 @@ static int noloris_conn(conn_rec *conn) shm_rec = apr_shm_baseaddr_get(shm); while (shm_rec[0] != '\0') { if (!strcmp(shm_rec, conn->remote_ip)) { - apr_socket_t *csd = ap_get_core_module_config(conn->conn_config); + apr_socket_t *csd = ap_get_conn_socket(conn); ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, conn, "Dropping connection from banned IP %s", conn->remote_ip); diff --git a/modules/filters/mod_reqtimeout.c b/modules/filters/mod_reqtimeout.c index 709e0923ea..5e7f4fbcec 100644 --- a/modules/filters/mod_reqtimeout.c +++ b/modules/filters/mod_reqtimeout.c @@ -186,7 +186,7 @@ static apr_status_t reqtimeout_filter(ap_filter_t *f, } if (!ccfg->socket) { - ccfg->socket = ap_get_core_module_config(f->c->conn_config); + ccfg->socket = ap_get_conn_socket(f->c); } rv = check_time_left(ccfg, &time_left); diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 932f6f28f3..fe26de70cd 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -208,7 +208,7 @@ static int ap_process_http_sync_connection(conn_rec *c) } if (!csd) { - csd = ap_get_core_module_config(c->conn_config); + csd = ap_get_conn_socket(c); } apr_socket_opt_set(csd, APR_INCOMPLETE_READ, 1); apr_socket_timeout_set(csd, c->base_server->keep_alive_timeout); diff --git a/modules/proxy/mod_proxy_connect.c b/modules/proxy/mod_proxy_connect.c index 578313ad2d..6da0a2d4dd 100644 --- a/modules/proxy/mod_proxy_connect.c +++ b/modules/proxy/mod_proxy_connect.c @@ -209,7 +209,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, apr_status_t err, rv; apr_size_t nbytes; char buffer[HUGE_STRING_LEN]; - apr_socket_t *client_socket = ap_get_core_module_config(c->conn_config); + apr_socket_t *client_socket = ap_get_conn_socket(c); int failed, rc; int client_error = 0; apr_pollset_t *pollset; diff --git a/modules/proxy/mod_proxy_fdpass.c b/modules/proxy/mod_proxy_fdpass.c index 2da9395ac2..ca547f8f50 100644 --- a/modules/proxy/mod_proxy_fdpass.c +++ b/modules/proxy/mod_proxy_fdpass.c @@ -221,9 +221,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, } } - /* XXXXX: THIS IS AN EVIL HACK */ - /* There should really be a (documented) public API for this ! */ - clientsock = ap_get_core_module_config(r->connection->conn_config); + clientsock = ap_get_conn_socket(r->connection); rv = send_socket(r->pool, sock, clientsock); if (rv != APR_SUCCESS) { diff --git a/server/connection.c b/server/connection.c index 9d9d582499..31279b3338 100644 --- a/server/connection.c +++ b/server/connection.c @@ -98,7 +98,7 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c) char dummybuf[512]; apr_size_t nbytes; apr_time_t timeup = 0; - apr_socket_t *csd = ap_get_core_module_config(c->conn_config); + apr_socket_t *csd = ap_get_conn_socket(c); if (!csd) { return; diff --git a/server/core.c b/server/core.c index c51759e4f8..d416266304 100644 --- a/server/core.c +++ b/server/core.c @@ -4302,6 +4302,11 @@ AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num) return &(req_cfg->notes[note_num]); } +AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c) +{ + return ap_get_core_module_config(c->conn_config); +} + static int core_create_req(request_rec *r) { /* Alloc the config struct and the array of request notes in diff --git a/server/protocol.c b/server/protocol.c index ef1906aed0..d78290af8f 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -953,7 +953,7 @@ request_rec *ap_read_request(conn_rec *conn) * to the normal timeout mode as we fetch the header lines, * as necessary. */ - csd = ap_get_core_module_config(conn->conn_config); + csd = ap_get_conn_socket(conn); apr_socket_timeout_get(csd, &cur_timeout); if (cur_timeout != conn->base_server->timeout) { apr_socket_timeout_set(csd, conn->base_server->timeout); |