我正在編寫類似於瀏覽器的程序,但更簡單。用戶鍵入鏈接,程序將其保存到本地文件中。數字在http頭部和內容中間的含義
我發送的HTTP標頭是這樣的:
GET /index.php HTTP/1.1\r\n
Host: www.highradio.tw\r\n
\r\n
然後我接到:
HTTP/1.1 200 OK
Date: Sat, 16 Apr 2011 14:16:29 GMT
Server: Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8q mod_wsgi/3.3 Python/2.7.1 PHP/5.2.5 (x64)
X-Powered-By: PHP/5.2.5 (x64)
Set-Cookie: PHPSESSID=d0ug0im94rg7lrjp40h38vo784; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html
204a
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
....
什麼數204a
平均(十六進制?)?
當我在終端中使用Chrome或wget
時,204a
不顯示。
我打印出第一個接收到的1024字節。我還沒有解析頭。 – benck 2011-04-16 14:35:02