issue 605, https and routes_in bug fixed, thanks Jonathan

This commit is contained in:
Massimo Di Pierro
2012-01-12 13:22:47 -06:00
parent c37720a92f
commit f032cf0df5
4 changed files with 7 additions and 7 deletions

View File

@@ -1 +1 @@
Version 1.99.4 (2012-01-12 12:51:07) stable
Version 1.99.4 (2012-01-12 13:22:21) stable

View File

@@ -143,7 +143,7 @@ def url_out(request, env, application, controller, function, args, other, scheme
host = True
if not scheme or scheme is True:
if request and request.env:
scheme = request.env.get('WSGI_URL_SCHEME', 'http').lower()
scheme = request.env.get('wsgi_url_scheme', 'http').lower()
else:
scheme = 'http' # some reasonable default in case we need it
if host is not None:
@@ -476,7 +476,7 @@ def regex_uri(e, regexes, tag, default=None):
host = host[:i]
key = '%s:%s://%s:%s %s' % \
(e.get('REMOTE_ADDR','localhost'),
e.get('WSGI_URL_SCHEME', 'http').lower(), host,
e.get('wsgi.url_scheme', 'http').lower(), host,
e.get('REQUEST_METHOD', 'get').lower(), path)
for (regex, value) in regexes:
if regex.match(key):
@@ -688,7 +688,7 @@ def filter_url(url, method='get', remote='0.0.0.0', out=False, app=False, lang=N
e = {
'REMOTE_ADDR': remote,
'REQUEST_METHOD': method,
'WSGI_URL_SCHEME': urlscheme,
'wsgi.url_scheme': urlscheme,
'HTTP_HOST': urlhost,
'REQUEST_URI': uri,
'PATH_INFO': path_info,
@@ -812,7 +812,7 @@ class MapUrlIn(object):
# see http://www.python.org/dev/peps/pep-3333/#url-reconstruction for URL composition
self.remote_addr = self.env.get('REMOTE_ADDR','localhost')
self.scheme = self.env.get('WSGI_URL_SCHEME', 'http').lower()
self.scheme = self.env.get('wsgi.url_scheme', 'http').lower()
self.method = self.env.get('REQUEST_METHOD', 'get').lower()
self.host = self.env.get('HTTP_HOST')
self.port = None

View File

@@ -845,7 +845,7 @@ class TestRouter(unittest.TestCase):
r = Storage()
r.env = Storage()
r.env.http_host = 'domain.com'
r.env.WSGI_URL_SCHEME = 'httpx' # distinguish incoming scheme
r.env.wsgi_url_scheme = 'httpx' # distinguish incoming scheme
self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f")
self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
"httpx://domain.com/a/c/f")

View File

@@ -304,7 +304,7 @@ routes_out = [
r = Storage()
r.env = Storage()
r.env.http_host = 'domain.com'
r.env.WSGI_URL_SCHEME = 'httpx' # distinguish incoming scheme
r.env.wsgi_url_scheme = 'httpx' # distinguish incoming scheme
self.assertEqual(str(URL(r=r, a='a', c='c', f='f')), "/a/c/f")
self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
"httpx://domain.com/a/c/f")