From 871fc591dd2492d2bdca0a530fdffac14f3feece Mon Sep 17 00:00:00 2001 From: Elrond Date: Wed, 21 Dec 2011 00:06:38 +0100 Subject: [PATCH] Workaround for Routes/urlgen bug. This is relevant for fcgi: Some servers (cherokee for example) put "HTTP":"off" in the environ. And the following code in urlgen breaks on this: if environ.get('HTTPS') or environ.get('wsgi.url_scheme') == 'https' \ or environ.get('HTTP_X_FORWARDED_PROTO') == 'https': hostinfo['protocol'] = 'https' workaround is to remove HTTPS:off from the environ. --- mediagoblin/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 04eb2acc..49dc8d97 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -122,6 +122,10 @@ class MediaGoblinApp(object): # The other option would be: # request.full_path = environ["SCRIPT_URL"] + # Fix up environ for urlgen + if environ.get('HTTPS', '').lower() == 'off': + environ.pop('HTTPS') + ## Attach utilities to the request object request.matchdict = route_match request.urlgen = routes.URLGenerator(self.routing, environ) -- 2.25.1