Skip to content Skip to sidebar Skip to footer

Is It A Good Idea To Use Transfer-encoding: Chunked On Static Files?

I've got your usual static site, where the server grabs .html files and sends them. I understand the importance of Transfer-Encoding: chunked for dynamic server pages, since that's

Solution 1:

Short answer: Yes, browsers do progressively render content sent with the Content-Length header. In fact, the browser does a bit less computing if it has the Content-Length header, since it knows up front how long the document is versus having to parse the document for the chunk information.

The Content-Length header (if any) must be sent before any of the content is sent. Therefore, the server must know the length of the document before sending any of the document content.

Chunked encoding is faster for dynamic content only. If a server could only use the Content-Length header, for dynamic content it would need to finish the document generation before sending out any content at all. This can cause the client to wait, possibly a long time without seeing any of the document.

Chunked encoding solves this by allowing the server to not have to send the Content-Length header.

Post a Comment for "Is It A Good Idea To Use Transfer-encoding: Chunked On Static Files?"