Author Arve.Knudsen
Recipients Arve.Knudsen
Date 2012-05-04.10:06:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
httplib doesn't specify the HTTP header 'content-length' for POST requests without data. Conceptually this makes sense, considering the empty content. However, IIS (7.5) servers don't accept such requests and respond with a 411 status code. See this question on StackOverflow for reference:

See also issue #223 of the Requests project,, which regards this problem in the context of the requests Python library.

The following code makes a data-less POST request to the HTTP sniffer Fiddler running on localhost:
import httplib
conn = httplib.HTTPConnection("localhost", 8888)
conn.request("POST", "/post", "", {})

Fiddler reports that it receives the following headers for the POST request, as you can see 'content-length' is not included:
POST http://localhost:8888/post HTTP/1.1
Host: localhost:8888
Accept-Encoding: identity
Date User Action Args
2012-05-04 10:06:44Arve.Knudsensetrecipients: + Arve.Knudsen
2012-05-04 10:06:43Arve.Knudsensetmessageid: <>
2012-05-04 10:06:43Arve.Knudsenlinkissue14721 messages
2012-05-04 10:06:42Arve.Knudsencreate