From e5f662ac57fa2c54882245e1c568e0982abab4fb Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Fri, 24 Dec 2010 02:54:32 +0000 Subject: Preserve HTTP request path when routing a request through a component reference. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1052431 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/modules/server/mod-wiring.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sca-cpp/trunk') diff --git a/sca-cpp/trunk/modules/server/mod-wiring.cpp b/sca-cpp/trunk/modules/server/mod-wiring.cpp index 67b179e7a1..e873733939 100644 --- a/sca-cpp/trunk/modules/server/mod-wiring.cpp +++ b/sca-cpp/trunk/modules/server/mod-wiring.cpp @@ -102,10 +102,13 @@ int translateReference(const ServerConf& sc, request_rec *r) { debug(target, "modwiring::translateReference::target"); // Route to an absolute target URI using mod_proxy or an HTTP client redirect + const list pathInfo = cdddr(rpath); if (httpd::isAbsolute(target)) { if (useModProxy) { - // 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, "://")))); + // Build proxy URI + // current request's protocol scheme, reference target uri and request path info + string turi = httpd::scheme(r) + substr(target, find(target, "://")) + path(pathInfo); + r->filename = apr_pstrdup(r->pool, c_str(string("proxy:") + turi)); debug(r->filename, "modwiring::translateReference::filename"); r->proxyreq = PROXYREQ_REVERSE; r->handler = "proxy-server"; @@ -118,7 +121,10 @@ int translateReference(const ServerConf& sc, request_rec *r) { } // 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, '/')))); + // /components/, target component name and request path info + const value tname = substr(target, 0, find(target, '/')); + const string tpath = path(cons(tname, pathInfo)); + r->filename = apr_pstrdup(r->pool, c_str(string("/redirect:/components") + tpath)); debug(r->filename, "modwiring::translateReference::filename"); r->handler = "mod_tuscany_wiring"; return OK; -- cgit v1.2.3