Patch 549151, rev4: redirect posts for 301 also. Will backport to 2.2.

This commit is contained in:
Martin v. Löwis 2003-07-12 07:33:32 +00:00
parent a685f52256
commit 162f081fb3
3 changed files with 22 additions and 14 deletions

View file

@ -431,9 +431,9 @@ class HTTPRedirectHandler(BaseHandler):
"""
m = req.get_method()
if (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
or code in (302, 303) and m == "POST"):
# Strictly (according to RFC 2616), 302 in response to a
# POST MUST NOT cause a redirection without confirmation
or code in (301, 302, 303) and m == "POST"):
# Strictly (according to RFC 2616), 301 or 302 in response
# to a POST MUST NOT cause a redirection without confirmation
# from the user (of urllib2, in this case). In practice,
# essentially all clients do redirect in this case, so we
# do the same.
@ -480,9 +480,9 @@ class HTTPRedirectHandler(BaseHandler):
http_error_301 = http_error_303 = http_error_307 = http_error_302
inf_msg = "The HTTP server returned a redirect error that would" \
inf_msg = "The HTTP server returned a redirect error that would " \
"lead to an infinite loop.\n" \
"The last 302 error message was:\n"
"The last 30x error message was:\n"
class ProxyHandler(BaseHandler):
# Proxies must be in front