您的位置:首页 > 理论基础 > 计算机网络

Something about HTTP Protocol

2014-11-19 23:06 169 查看
0. An HTTP request consists of three components:* Method—–URI—Protocol/Version* Request headers* Entity bodyAn example of an HTTP request is the following:POST /servlet/default.jsp HTTP/1.1Accept: text/plain; text/html© Budi Kurniawan 2003 2Accept-Language: en-gbConnection: Keep-AliveHost: localhostReferer: http://localhost/ch8/SendDetails.htm User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)Content-Length: 33Content-Type: application/x-www-form-urlencodedAccept-Encoding: gzip, deflateLastName=Franks&FirstName=Michael1. Replacing HTTP/1.0 is the current version of HTTP/1.1, which is defined by RFC 2616 and downloadable from http://www.w3.org/Protocols/HTTP/1.1/rfc2616.pdf 2. HTTP Requests:The method—URI—protocol version appears as the first line of the request.A URL is actually a type of URI (see http://www.ietf.org/rfc/rfc2396.txt).
URI 是从虚拟根路径开始的
URL是整个链接
如URL http://zhidao.baidu.com/question/68016373.html
URI 是/question/68016373.html
百度服务器把http://zhidao.baidu.com/制作成了虚拟的路径的根
3. Between the headers and the entity body, there is a blank line (CRLF) that isimportant to the HTTP request format. The CRLF tells the HTTP server where the entitybody begins. In some Internet programming books, this CRLF is considered the fourthcomponent of an HTTP request.
CRLF is carriage return/linefeed
4.Similar to requests, an HTTP response also consists of three parts:
* Protocol—Status code–—Description* Response headers* Entity bodyThe following is an example of an HTTP response:
HTTP/1.1 200 OKServer: Microsoft-IIS/4.0Date: Mon, 3 Jan 1998 13:13:33 GMTContent-Type: text/htmlLast-Modified: Mon, 11 Jan 1998 13:23:42 GMTContent-Length: 112<HTML><HEAD><TITLE>HTTP Response Example</TITLE></HEAD><BODY>Welcome to Brainy Software</BODY></HTML>

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: