From: Elrond Date: Tue, 20 Dec 2011 23:06:38 +0000 (+0100) Subject: Workaround for Routes/urlgen bug. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=871fc591dd2492d2bdca0a530fdffac14f3feece;p=mediagoblin.git 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. --- 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)