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.
This commit is contained in:
parent
463a5dcc43
commit
871fc591dd
@ -122,6 +122,10 @@ class MediaGoblinApp(object):
|
|||||||
# The other option would be:
|
# The other option would be:
|
||||||
# request.full_path = environ["SCRIPT_URL"]
|
# 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
|
## Attach utilities to the request object
|
||||||
request.matchdict = route_match
|
request.matchdict = route_match
|
||||||
request.urlgen = routes.URLGenerator(self.routing, environ)
|
request.urlgen = routes.URLGenerator(self.routing, environ)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user