Export to GitHub

httplib2 - issue #196

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


Posted on Dec 8, 2011 by Massive Cat

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.

Status: New

Labels:
Type-Defect Priority-Medium