Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't IIS support chunked transfer encoding?

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?

like image 493
Graeme Perrow Avatar asked Dec 03 '08 20:12

Graeme Perrow


2 Answers

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

like image 136
rupello Avatar answered Sep 18 '22 15:09

rupello


My understanding is that chunked encoding can only be used in a HTTP response. A chunked request body would have the property of being incompatible with a 1.0 server, and in any case, there would be no way of a user-agent knowing that the server was a 1.0 server until it had already sent the request.

But I agree it's unclear from the documentation.

like image 26
MarkR Avatar answered Sep 18 '22 15:09

MarkR