tanmayameher/httplib2

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

Opened this issue · 0 comments

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