Looking at various web servers HTTP Headers, I notice that Google.com has:
client-transfer-encoding: "chunked"
What is chuncked transfer encoding and should I be using it on my web server?
Looking at various web servers HTTP Headers, I notice that Google.com has:
client-transfer-encoding: "chunked"
What is chuncked transfer encoding and should I be using it on my web server?
Chunked can be used to send a HTTP request or response in multiple parts, and send one part while subsequent parts are not available.
Multiple request--response pairs can be transferred over a single HTTP connection. (This is to avoid the overhead of the TCP connect() for subsequent requests.) To implement this, the client needs to know where the server response ends. If the server generates the Content-Length header, the client can count down the bytes. When there are no bytes left to read, the client can initiate the next request. But how would the server generate the Content-Length header if it doesn't know the length of the full response in advance? The solution is to use chunked instead of Content-Length.
Apache (1.3 and 2), by default, sends static files as chunked whenever it makes sense (and the HTTP client supports it). You don't have to take any action. If you write your own web application, you might consider generating a chunked response by hand.
See http://www.research.att.com/~bala/papers/h0vh1.html and http://developers.sun.com/mobility/midp/questions/chunking/ for a little more.