當收到來自http://www.google.com/
的原始響應時,缺少Content-Length
標題。相反,要接收的字節數位於標題代碼\r\n\r\n
結束之後但在實際內容之前。HTTP響應:Google放錯了內容長度
我查看了原始響應,並且8000
包含\r\n
作爲行尾。
偏谷歌響應
部首
HTTP/1.1 200 OK
Date: Tue, 28 Oct 2014 18:38:37 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: ...
Set-Cookie: ...
P3P: ...
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic,p=0.01
Transfer-Encoding: chunked
部首
8000 # has '\r\n', I am assuming this is the content-length?
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content...`
結束響應
所以(由 '\ r \ n \ r \ N' 表示)的完我的問題是谷歌爲什麼如此特別,他們可以搞砸我重新發明的HTTP輪。如果我在所有的迴應中或僅僅從谷歌來解釋這種情況。
您可能會在進行指責之前做一些調查。具有諷刺意味的是,谷歌搜索「content-length missing」的第一個結果爲答案提供了線索。另外,如果你「重新發明HTTP輪子」,你應該儘可能地學習標準的HTTP頭(任何不以「X-」開頭的東西);如果您對「Transfer-Encoding」標題感興趣,那麼您也可以通過這種方式找到答案。 – krait 2015-01-09 18:53:34