server. This change adds an optional hook, which allows modules
to gain control while the request is created if the proxy module
is loaded. The purpose of this hook is to allow modules to add
input and/or output filters to the request to the origin. While
I was at it, I made the core use this hook, so that proxy request
creation uses some of the code from the core. This can still be
greatly improved, but this is a good start.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91486
13f79535-47bb-0310-9956-
ffa450edef68
Changes with Apache 2.0.27-dev
+ *) Cleanup the proxy code that creates a request to the origin
+ server. This change adds an optional hook, which allows modules
+ to gain control while the request is created if the proxy module
+ is loaded. The purpose of this hook is to allow modules to add
+ input and/or output filters to the request to the origin. While
+ I was at it, I made the core use this hook, so that proxy request
+ creation uses some of the code from the core. This can still be
+ greatly improved, but this is a good start. [Ryan Bloom]
+
Changes with Apache 2.0.26
*) Port the MaxClients changes from the worker MPM to the threaded
if test "$abs_builddir" != "$abs_srcdir"; then
USE_VPATH=1
- APR_ADDTO(INCLUDES, [-I. -I\$(srcdir) -I\$(top_builddir)/os/\$(OS_DIR) -I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_builddir)/server/mpm/\$(MPM_NAME) -I\$(top_srcdir)/server/mpm/\$(MPM_NAME) -I\$(top_builddir)/modules/http -I\$(top_srcdir)/modules/http -I\$(top_builddir)/include -I\$(top_srcdir)/include -I\$(top_builddir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_builddir)/srclib/apr-util/include -I\$(top_srcdir)/srclib/apr-util/include])
+ APR_ADDTO(INCLUDES, [-I. -I\$(srcdir) -I\$(top_builddir)/os/\$(OS_DIR) -I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_builddir)/server/mpm/\$(MPM_NAME) -I\$(top_srcdir)/server/mpm/\$(MPM_NAME) -I\$(top_builddir)/modules/http -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/proxy -I\$(top_builddir)/include -I\$(top_srcdir)/include -I\$(top_builddir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_builddir)/srclib/apr-util/include -I\$(top_srcdir)/srclib/apr-util/include])
else
- APR_ADDTO(INCLUDES, [-I. -I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include])
+ APR_ADDTO(INCLUDES, [-I. -I\$(top_srcdir)/os/\$(OS_DIR) -I\$(top_srcdir)/server/mpm/\$(MPM_NAME) -I\$(top_srcdir)/modules/http -I\$(top_srcdir)/modules/proxy -I\$(top_srcdir)/include -I\$(top_srcdir)/srclib/apr/include -I\$(top_srcdir)/srclib/apr-util/include])
fi
echo $ac_n "${nl}Applying OS-specific hints for httpd ...${nl}"
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r,
char *url))
+APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))
+
/* proxy_util.c */
PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r);
static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
static int proxy_match_word(struct dirconn_entry *This, request_rec *r);
+APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, AP, int, create_req,
+ (request_rec *r, request_rec *pr), (r, pr),
+ OK, DECLINED)
+
/* already called in the knowledge that the characters are hex digits */
PROXY_DECLARE(int) ap_proxy_hex2c(const char *x)
{
PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r)
{
request_rec *rp = apr_pcalloc(c->pool, sizeof(*r));
- core_request_config *req_cfg;
rp->pool = c->pool;
rp->status = HTTP_OK;
rp->server = r->server;
rp->request_time = r->request_time;
rp->connection = c;
- rp->output_filters=NULL;
- rp->input_filters=NULL;
rp->output_filters = c->output_filters;
rp->input_filters = c->input_filters;
rp->request_config = ap_create_request_config(c->pool);
- req_cfg = apr_pcalloc(rp->pool, sizeof(core_request_config));
- req_cfg->bb = apr_brigade_create(c->pool);
- ap_set_module_config(rp->request_config, &core_module, req_cfg);
+ proxy_run_create_req(r, rp);
return rp;
}
#include "mpm_common.h"
#include "scoreboard.h"
#include "mod_core.h"
+#include "mod_proxy.h"
/* LimitXMLRequestBody handling */
return OK;
}
+static int core_create_proxy_req(request_rec *r, request_rec *pr)
+{
+ core_create_req(pr);
+}
+
static void register_hooks(apr_pool_t *p)
{
ap_hook_post_config(core_post_config,NULL,NULL,APR_HOOK_REALLY_FIRST);
ap_hook_fixups(core_override_type,NULL,NULL,APR_HOOK_REALLY_FIRST);
ap_hook_access_checker(do_nothing,NULL,NULL,APR_HOOK_REALLY_LAST);
ap_hook_create_request(core_create_req, NULL, NULL, APR_HOOK_MIDDLE);
+ APR_OPTIONAL_HOOK(proxy, create_req, core_create_proxy_req, NULL, NULL,
+ APR_HOOK_MIDDLE);
ap_hook_pre_mpm(ap_create_scoreboard, NULL, NULL, APR_HOOK_MIDDLE);
/* register the core's insert_filter hook and register core-provided