From 9d60b6e13f23615dd07f463f6dba17a440139000 Mon Sep 17 00:00:00 2001 From: Marcel Hellkamp Date: Fri, 13 May 2011 22:24:03 +0200 Subject: fix: "SERVER_NAME is substituted for '127.0.0.1' for relative redirects" issue #159 SERVER_NAME is only required for HTTP/1.0 clients that do not define a HTTP_HOST header. The HOST header, if present, should be correct. --- test/test_environ.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test/test_environ.py') diff --git a/test/test_environ.py b/test/test_environ.py index 3612027..f917e70 100755 --- a/test/test_environ.py +++ b/test/test_environ.py @@ -242,6 +242,8 @@ class TestResponse(unittest.TestCase): if name.title() == 'Set-Cookie'] self.assertTrue('name=;' in cookies[0]) + + class TestRedirect(unittest.TestCase): def assertRedirect(self, target, result, query=None, status=303, **args): @@ -251,7 +253,6 @@ class TestRedirect(unittest.TestCase): args[key.replace('_', '.', 1)] = args[key] del args[key] env.update(args) - wsgiref.util.setup_testing_defaults(env) request.bind(env) try: bottle.redirect(target, **(query or {})) @@ -313,8 +314,6 @@ class TestRedirect(unittest.TestCase): HTTP_X_FORWARDED_HOST='example.com') self.assertRedirect('./test.html', 'http://example.com/test.html', SERVER_NAME='example.com') - self.assertRedirect('./test.html', 'http://example.com/test.html', - HTTP_HOST='example.com:80') self.assertRedirect('./test.html', 'http://example.com:81/test.html', HTTP_HOST='example.com:81') self.assertRedirect('./test.html', 'http://127.0.0.1:81/test.html', -- cgit v1.2.1