跳至主要内容

HTTP指令的简单解释

HTTP无疑是日常生活中使用最多的Internet协议之一。在企业级别的应用程序中,HTTP是当之无愧的最受程序员喜爱的通信协议。最近恰好在做几个简单的HTTP程序,为了更好的看清常见的GET/POST等指令是如何应用于实际通讯中的,截取了一段interaction log。

第一部分是HTTP Request,这里show的是GET method。
GET /polish/j2mepolish-2.0-beta3.jar HTTP/1.1
Host: download.berlios.de
Accept: */*
Referer: http://prdownload.berlios.de/polish/j2mepolish-2.0-beta3.jar
User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Pragma: no-cache
Cache-Control: no-cache
Connection: close


第二部分是server的response。
HTTP/1.1 200 OK
Date: Sat, 13 Jan 2007 06:57:28 GMT
Server: Apache/2.0.54 (Linux/SUSE)
X-Powered-By: PHP/4.4.0
Cache-Control: must-revalidate, post-check=0, pre-check=0
Content-Length: 21453320
Content-Transfer-Encoding: binary
Content-Disposition: attachment; filename="j2mepolish-2.0-beta3.jar";
Connection: close
Content-Type: application/x-download

评论