summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/server/mod-wiring.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-22 05:02:05 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-22 05:02:05 +0000
commitb70da6b982209e43079708df1da43ae4054f3d80 (patch)
tree771373588a59d5ab895bdd15f1f97e3ec65a398d /sca-cpp/trunk/modules/server/mod-wiring.cpp
parent8eee1434bbc9b66bf5f005cefc88306c9bf999dd (diff)
Refactor store-cluster sample components to allow vhosts to share common cache and database components. Minor fixes to config scripts and wiring code to get that combination working.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@987844 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/server/mod-wiring.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/sca-cpp/trunk/modules/server/mod-wiring.cpp b/sca-cpp/trunk/modules/server/mod-wiring.cpp
index 32217172fd..17cfcaae0e 100644
--- a/sca-cpp/trunk/modules/server/mod-wiring.cpp
+++ b/sca-cpp/trunk/modules/server/mod-wiring.cpp
@@ -109,7 +109,9 @@ int translateReference(const ServerConf& sc, request_rec *r) {
// Route to an absolute target URI using mod_proxy or an HTTP client redirect
if (isAbsolute(target)) {
if (useModProxy) {
- r->filename = apr_pstrdup(r->pool, c_str(string("proxy:") + target));
+ // Build proxy URI using current request's protocol scheme
+ r->filename = apr_pstrdup(r->pool, c_str(string("proxy:") + httpd::scheme(r) + substr(target, find(target, "://"))));
+ debug(r->filename, "modwiring::translateReference::filename");
r->proxyreq = PROXYREQ_REVERSE;
r->handler = "proxy-server";
return OK;
@@ -117,12 +119,15 @@ int translateReference(const ServerConf& sc, request_rec *r) {
r->status = HTTP_MOVED_TEMPORARILY;
apr_table_setn(r->headers_out, "Location", apr_pstrdup(r->pool, c_str(target)));
+ r->filename = apr_pstrdup(r->pool, c_str(string("/redirect:/") + target));
+ debug(target, "modwiring::translateReference::location");
r->handler = "mod_tuscany_wiring";
return OK;
}
// Route to a relative target URI using a local internal redirect
r->filename = apr_pstrdup(r->pool, c_str(string("/redirect:/components/") + substr(target, 0, find(target, '/'))));
+ debug(r->filename, "modwiring::translateReference::filename");
r->handler = "mod_tuscany_wiring";
return OK;
}
@@ -310,7 +315,7 @@ int translate(request_rec *r) {
gc_scoped_pool pool(r->pool);
const ServerConf& sc = httpd::serverConf<ServerConf>(r, &mod_tuscany_wiring);
- // Process dynamic virtual host configuration, if any
+ // Process dynamic virtual host configuration
VirtualHostConf vhc(sc);
const bool usevh = hasVirtualCompositeConf(vhc.sc) && httpd::isVirtualHostRequest(sc.server, r);
if (usevh) {
@@ -338,14 +343,17 @@ int handler(request_rec *r) {
if (r->filename == NULL || strncmp(r->filename, "/redirect:", 10) != 0)
return DECLINED;
+ // Nothing to do for an external redirect
+ if (r->status == HTTP_MOVED_TEMPORARILY)
+ return OK;
+
+ // Do an internal redirect
gc_scoped_pool pool(r->pool);
httpdDebugRequest(r, "modwiring::handler::input");
- // Do an internal redirect
debug(r->uri, "modwiring::handler::uri");
debug(r->filename, "modwiring::handler::filename");
debug(r->path_info, "modwiring::handler::path info");
-
if (r->args == NULL)
return httpd::internalRedirect(httpd::redirectURI(string(r->filename + 10), string(r->path_info)), r);
return httpd::internalRedirect(httpd::redirectURI(string(r->filename + 10), string(r->path_info), string(r->args)), r);