This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: http redirect does not pass 'post' data
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: calvin, hans_moleman, loewis
Priority: normal Keywords:

Created on 2006-10-01 21:08 by hans_moleman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg30098 - (view) Author: hans_moleman (hans_moleman) Date: 2006-10-01 21:08
A HTTP(S) redirect does not pass POST 'data'.

Currently:
If a redirect is required, a new Request is created
with a URL that the redirect response has provided.
This new Request has the original headers.

Required:
For the new Request the data too will be copied from
the original Request.

I believe the following one line change is required in
'urllib2.HTTPRedirectHandler.redirect_request':

<code>
return Request(url     = newurl,
               headers = req.headers,
               data    = req.data,
               ...
</code>

Environment: Linux
Python 2.5
msg30099 - (view) Author: Bastian Kleineidam (calvin) Date: 2006-10-02 09:14
Logged In: YES 
user_id=9205

Automatic redirects are only allowed for GET and HEAD[1].
Sending POST data automatically to other hosts than the
original one is a security flaw.
[1]
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3

So I think the current behaviour of urllib2 is correct, and
should not be changed.
msg30100 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-10-02 15:08
Logged In: YES 
user_id=21627

I agree with calvin; this is not a bug.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44062
2006-10-01 21:08:05hans_molemancreate