issue 605, https and routes_in bug fixed, thanks Jonathan
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 1.99.4 (2012-01-12 12:51:07) stable
|
Version 1.99.4 (2012-01-12 13:22:21) stable
|
||||||
|
|||||||
+4
-4
@@ -143,7 +143,7 @@ def url_out(request, env, application, controller, function, args, other, scheme
|
|||||||
host = True
|
host = True
|
||||||
if not scheme or scheme is True:
|
if not scheme or scheme is True:
|
||||||
if request and request.env:
|
if request and request.env:
|
||||||
scheme = request.env.get('WSGI_URL_SCHEME', 'http').lower()
|
scheme = request.env.get('wsgi_url_scheme', 'http').lower()
|
||||||
else:
|
else:
|
||||||
scheme = 'http' # some reasonable default in case we need it
|
scheme = 'http' # some reasonable default in case we need it
|
||||||
if host is not None:
|
if host is not None:
|
||||||
@@ -476,7 +476,7 @@ def regex_uri(e, regexes, tag, default=None):
|
|||||||
host = host[:i]
|
host = host[:i]
|
||||||
key = '%s:%s://%s:%s %s' % \
|
key = '%s:%s://%s:%s %s' % \
|
||||||
(e.get('REMOTE_ADDR','localhost'),
|
(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)
|
e.get('REQUEST_METHOD', 'get').lower(), path)
|
||||||
for (regex, value) in regexes:
|
for (regex, value) in regexes:
|
||||||
if regex.match(key):
|
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 = {
|
e = {
|
||||||
'REMOTE_ADDR': remote,
|
'REMOTE_ADDR': remote,
|
||||||
'REQUEST_METHOD': method,
|
'REQUEST_METHOD': method,
|
||||||
'WSGI_URL_SCHEME': urlscheme,
|
'wsgi.url_scheme': urlscheme,
|
||||||
'HTTP_HOST': urlhost,
|
'HTTP_HOST': urlhost,
|
||||||
'REQUEST_URI': uri,
|
'REQUEST_URI': uri,
|
||||||
'PATH_INFO': path_info,
|
'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
|
# see http://www.python.org/dev/peps/pep-3333/#url-reconstruction for URL composition
|
||||||
self.remote_addr = self.env.get('REMOTE_ADDR','localhost')
|
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.method = self.env.get('REQUEST_METHOD', 'get').lower()
|
||||||
self.host = self.env.get('HTTP_HOST')
|
self.host = self.env.get('HTTP_HOST')
|
||||||
self.port = None
|
self.port = None
|
||||||
|
|||||||
@@ -845,7 +845,7 @@ class TestRouter(unittest.TestCase):
|
|||||||
r = Storage()
|
r = Storage()
|
||||||
r.env = Storage()
|
r.env = Storage()
|
||||||
r.env.http_host = 'domain.com'
|
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')), "/a/c/f")
|
||||||
self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
|
self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
|
||||||
"httpx://domain.com/a/c/f")
|
"httpx://domain.com/a/c/f")
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ routes_out = [
|
|||||||
r = Storage()
|
r = Storage()
|
||||||
r.env = Storage()
|
r.env = Storage()
|
||||||
r.env.http_host = 'domain.com'
|
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')), "/a/c/f")
|
||||||
self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
|
self.assertEqual(str(URL(r=r, a='a', c='c', f='f', host=True)),
|
||||||
"httpx://domain.com/a/c/f")
|
"httpx://domain.com/a/c/f")
|
||||||
|
|||||||
Reference in New Issue
Block a user