trungn1992 / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

hang on 302/303 redirect after post with content-length header #196

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Do a POST request with a payload and manually set the Content-Length header.

If the server redirects (302 or 303), then httplib2 will follow the redirect, 
but remove the payload from that request. But it does not reset the 
Content-Length header, so the server will be expecting more data than will be 
sent.

The fix is to delete the Content-Length header on line 1243 ('body = None').

The workaround is to not set the Content-Length header if you're POSTing and 
might encounter a redirect.

Original issue reported on code.google.com by aburgel on 8 Dec 2011 at 4:54