Looking at various web servers HTTP Headers, I notice that Google.com has:
看看各种Web服务器HTTP Headers,我注意到Google.com有:
client-transfer-encoding: "chunked"
What is chuncked transfer encoding and should I be using it on my web server?
什么是chuncked传输编码,我应该在我的Web服务器上使用它?
1 个解决方案
#1
Chunked can be used to send a HTTP request or response in multiple parts, and send one part while subsequent parts are not available.
Chunked可用于在多个部分中发送HTTP请求或响应,并在后续部分不可用时发送一个部分。
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.
可以通过单个HTTP连接传输多个请求 - 响应对。 (这是为了避免后续请求的TCP connect()开销。)为实现这一点,客户端需要知道服务器响应的结束位置。如果服务器生成Content-Length标头,则客户端可以倒计数字节。当没有剩余字节要读取时,客户端可以发起下一个请求。但是,如果服务器事先不知道完整响应的长度,它将如何生成Content-Length头?解决方案是使用chunked而不是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.
默认情况下,Apache(1.3和2)只要有意义(并且HTTP客户端支持它)就会将静态文件发送为chunked。您不必采取任何行动。如果您编写自己的Web应用程序,则可以考虑手动生成分块响应。
See http://www.research.att.com/~bala/papers/h0vh1.html and http://developers.sun.com/mobility/midp/questions/chunking/ for a little more.
请访问http://www.research.att.com/~bala/papers/h0vh1.html和http://developers.sun.com/mobility/midp/questions/chunking/了解更多信息。
#1
Chunked can be used to send a HTTP request or response in multiple parts, and send one part while subsequent parts are not available.
Chunked可用于在多个部分中发送HTTP请求或响应,并在后续部分不可用时发送一个部分。
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.
可以通过单个HTTP连接传输多个请求 - 响应对。 (这是为了避免后续请求的TCP connect()开销。)为实现这一点,客户端需要知道服务器响应的结束位置。如果服务器生成Content-Length标头,则客户端可以倒计数字节。当没有剩余字节要读取时,客户端可以发起下一个请求。但是,如果服务器事先不知道完整响应的长度,它将如何生成Content-Length头?解决方案是使用chunked而不是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.
默认情况下,Apache(1.3和2)只要有意义(并且HTTP客户端支持它)就会将静态文件发送为chunked。您不必采取任何行动。如果您编写自己的Web应用程序,则可以考虑手动生成分块响应。
See http://www.research.att.com/~bala/papers/h0vh1.html and http://developers.sun.com/mobility/midp/questions/chunking/ for a little more.
请访问http://www.research.att.com/~bala/papers/h0vh1.html和http://developers.sun.com/mobility/midp/questions/chunking/了解更多信息。