Why doesn't IIS support chunked transfer encoding?

Graeme Perrow picture Graeme Perrow · Dec 3, 2008 · Viewed 10.3k times · Source

I am making an HTTP connection to an IIS web server and sending a POST request with the data encoded using Transfer-Encoding: chunked. When I do this, IIS simply closes the connection, with no error message or status code. According to the HTTP 1.1 spec,

All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer-coding

so I don't understand why it's (a) not handling that encoding and (b) it's not sending back a status code. If I change the request to send the Content-Length rather than Transfer-Encoding, the query succeeds, but that's not always possible.

When I try the same thing against Apache, I get a "411 Length required" status and a message saying "chunked Transfer-Encoding forbidden".

Why do these servers not support this encoding?

Answer

rupello picture rupello · Jul 30, 2009

Take a look at your client.

Both IIS & Apache support POST requests using chunked transfer-encoding. You can verify this using the curl utility:

curl <upload-url> --form "upfile=@<local_file>" --header "Transfer-Encoding: chunked"

Verify the transfer is chunked using Wireshark