diff options
| author | Robert Brewer <fumanchu@aminus.org> | 2006-11-16 20:59:58 +0000 |
|---|---|---|
| committer | Robert Brewer <fumanchu@aminus.org> | 2006-11-16 20:59:58 +0000 |
| commit | 77a3d3e376d97f4dc5871aebf29a07104b4dd5f3 (patch) | |
| tree | 7f482c68e23b21818b081987e0a3e9bd4dca64d6 /cherrypy/lib/cptools.py | |
| parent | 9a3c726bceed8866accdb385583f79c9f78f08aa (diff) | |
| download | cherrypy-git-77a3d3e376d97f4dc5871aebf29a07104b4dd5f3.tar.gz | |
Fix for #600 (InternalRedirect does double duty). This dispwrappers.patch changes vhost and xmlrpc from using InternalRedirect (which rewrites request.path_info) to dispatch wrapper functions (which do not).
Diffstat (limited to 'cherrypy/lib/cptools.py')
| -rw-r--r-- | cherrypy/lib/cptools.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/cherrypy/lib/cptools.py b/cherrypy/lib/cptools.py index fb66738e..b7d56395 100644 --- a/cherrypy/lib/cptools.py +++ b/cherrypy/lib/cptools.py @@ -272,38 +272,6 @@ to this function: for k in dir(SessionAuth) if not k.startswith("__")]) -def virtual_host(use_x_forwarded_host=True, **domains): - """Redirect internally based on the Host header. - - Useful when running multiple sites within one CP server. - - From http://groups.google.com/group/cherrypy-users/browse_thread/thread/f393540fe278e54d: - - For various reasons I need several domains to point to different parts of a - single website structure as well as to their own "homepage" EG - - http://www.mydom1.com -> root - http://www.mydom2.com -> root/mydom2/ - http://www.mydom3.com -> root/mydom3/ - http://www.mydom4.com -> under construction page - - but also to have http://www.mydom1.com/mydom2/ etc to be valid pages in - their own right. - """ - request = cherrypy.request - - # Guard against running twice. - if hasattr(request, "virtual_prefix"): - return - - domain = request.headers.get('Host', '') - if use_x_forwarded_host: - domain = request.headers.get("X-Forwarded-Host", domain) - - request.virtual_prefix = prefix = domains.get(domain, "") - if prefix: - raise cherrypy.InternalRedirect(_http.urljoin(prefix, request.path_info)) - def log_traceback(): """Write the last error's traceback to the cherrypy error log.""" from cherrypy import _cperror |
