summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-01-04 06:47:30 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-01-04 06:47:30 (GMT)
commit239a0429fdd8af2ff8a8a5fccbc19fe640d992b5 (patch)
tree9b505582c0b76dc16e5beb1f083e45b0a60806b6 /Lib/test
parent606e19dda3da637783e8b76b5919e0c57808bddd (diff)
parent6497aa3e00162752ebfae20e3e62a67e796d7630 (diff)
downloadcpython-239a0429fdd8af2ff8a8a5fccbc19fe640d992b5.zip
cpython-239a0429fdd8af2ff8a8a5fccbc19fe640d992b5.tar.gz
cpython-239a0429fdd8af2ff8a8a5fccbc19fe640d992b5.tar.bz2
merge from 3.2
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib2.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index bcf5916..0ff3181 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1076,6 +1076,19 @@ class HandlerTests(unittest.TestCase):
MockHeaders({"location": valid_url}))
self.assertEqual(o.req.get_full_url(), valid_url)
+ def test_relative_redirect(self):
+ from_url = "http://example.com/a.html"
+ relative_url = "/b.html"
+ h = urllib.request.HTTPRedirectHandler()
+ o = h.parent = MockOpener()
+ req = Request(from_url)
+ req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT
+
+ valid_url = urllib.parse.urljoin(from_url,relative_url)
+ h.http_error_302(req, MockFile(), 302, "That's fine",
+ MockHeaders({"location": valid_url}))
+ self.assertEqual(o.req.get_full_url(), valid_url)
+
def test_cookie_redirect(self):
# cookies shouldn't leak into redirected requests
from http.cookiejar import CookieJar