[Python-checkins] python/dist/src/Lib urllib2.py,1.24.8.6,1.24.8.7
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 22 May 2003 10:30:51 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv12344
Modified Files:
Tag: release22-maint
urllib2.py
Log Message:
Backport Jeremy's fix: req.method should be req.get_method.
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.24.8.6
retrieving revision 1.24.8.7
diff -C2 -d -r1.24.8.6 -r1.24.8.7
*** urllib2.py 5 May 2003 04:10:40 -0000 1.24.8.6
--- urllib2.py 22 May 2003 17:30:48 -0000 1.24.8.7
***************
*** 417,426 ****
"""
! if (code in (301, 302, 303, 307) and req.method() in ("GET", "HEAD") or
! code in (302, 303) and req.method() == "POST"):
! # Strictly (according to RFC 2616), 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.
return Request(newurl, headers=req.headers)
else:
--- 417,428 ----
"""
! 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
! # from the user (of urllib2, in this case). In practice,
! # essentially all clients do redirect in this case, so we
! # do the same.
return Request(newurl, headers=req.headers)
else: