Transfer-Encoding: chunked

后端 未结 2 636
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 07:52

I was trying to understand more on Transfer-Encoding:chunked. referred some articles: http://zoompf.com/blog/2012/05/too-chunky and "Transfer-Encoding: chunked

相关标签:
2条回答
  • 2021-01-31 08:06

    When the server needs to send large amount of data, chunked encoding is used by the server because it did not exactly know how big (length) the data is going to be. In HTTP terms, when server sends response Content-Length header is omitted by the server. Instead server writes the length of current chunk in hexadecimal format followed by \r\n and then chunk, followed by \r\n (Content begins with chunk size in hex followed by chunk)

    This feature can be used for progressive rendering; however the server needs to flush the data as much as possible so that client can render content progressively (in case of html,css etc)

    This feature is often used when server pushes data to the client in large amounts - usually in large size (mega/giga)

    Mozilla Documentation

    0 讨论(0)
  • 2021-01-31 08:19

    Transfer-Encoding: chunked isn't needed for progressive rendering. However, it is needed when the total content length is unknown before the first bytes are sent.

    0 讨论(0)
提交回复
热议问题