Make request.fullurl reflect the c.secure url_scheme change.

This commit is contained in:
Max Goodman
2013-08-28 16:29:20 -07:00
committed by Neil Williams
parent 01582db9e6
commit 552e9828ab
3 changed files with 3 additions and 6 deletions

View File

@@ -275,11 +275,6 @@ class FullPathMiddleware(object):
qs = environ.get('QUERY_STRING')
if qs:
environ['FULLPATH'] += '?' + qs
environ['FULLURL'] = "%s://%s%s" % (
environ['wsgi.url_scheme'],
environ['HTTP_HOST'],
environ['FULLPATH']
)
return self.app(environ, start_response)
class StaticTestMiddleware(object):

View File

@@ -750,6 +750,8 @@ class MinimalController(BaseController):
# upstream things like stunnel/haproxy.
if c.secure:
request.environ["wsgi.url_scheme"] = "https"
# update request.fullurl since wsgi.url_scheme changed.
request.fullurl = request.host_url + request.fullpath
c.request_origin = request.host_url

View File

@@ -101,7 +101,7 @@ class BaseController(WSGIController):
request.referer = environ.get('HTTP_REFERER')
request.user_agent = environ.get('HTTP_USER_AGENT')
request.fullpath = environ.get('FULLPATH', request.path)
request.fullurl = environ.get('FULLURL', request.url)
request.fullurl = request.host_url + request.fullpath
request.port = environ.get('request_port')
if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE')