从标头接收原始响应时http://www.google.com/
丢失Content-Length
。相反,要接收的字节数放置在标头代码的末尾\r\n\r\n
但实际内容之前。
我查看了原始响应和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
标头结尾(由 '\r\n\r\n' 表示)
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...`
结束响应
所以我的问题是为什么谷歌如此特别,以至于他们可以搞砸我对 HTTP 轮子的重新发明。如果我应该在我的所有回复中或仅来自谷歌的回复中考虑到这种情况。