0
從這個wikipedia example 一個典型的HTTP響應可能看起來像這樣HTTP如何指定傳輸編碼響應的結束:分塊?
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Content-Type: text/html; charset=UTF-8
Content-Encoding: UTF-8
Content-Length: 138
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
ETag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Connection: close
<html>
<head>
<title>An Example Page</title>
</head>
<body>
Hello World, this is a very simple HTML document.
</body>
</html>
在這種情況下,因爲這個頭的:
Connection: close
的客戶都知道,HTTP主體已經完成,是因爲TCP連接將關閉,例如說Connection: close
不存在,客戶端仍然知道HTTP正文已完成,因爲此標頭爲:
Content-Length: 138
是說,一旦你得到138字節,我們就完成了。但是在這些標題都沒有被使用的情況下,服務器發送Transfer-encoding: chunked
如何知道響應已經完成,以便它可以移動到其他東西?
哇,你釘了它:)如果我能我接受這個(Stackoverflow施加時間限制) –