Http協議中的Header與Body
Header的每行最后要加\r\n
Header與Body之間要用\r\n隔開
Body后無需加\r\n
ACSII碼中
'\n' 10 換行
'\r' 13 回車
也可以表示為'\x0a'和'\x0d'.(16進制)
示例:HTTP開始部分為header,<html>部分為body。
HTTP/1.1 200 OK\r\n
Content-Encoding: gzip\r\n
Content-Type: text/xml\r\n
Content-Length: 399\r\n
Connection: keep-alive\r\n
X-Varnish-Cache: HIT\r\n
X-Varnish-Cache-Hits: 1241\r\n
\r\n
<html.....</html>
原文:
http://hi.baidu.com/sinfiasong/item/38776830ed3034149cc65e3a