HTTP协议

HTTP协议

 http协议时建立在tcp协议之上的
 要先开启telnet的客服端,开启你的应用服务器
 GET /SoftWeb/index.jsp HTTP/1.1
 Host:localhost
 http1.0和http1.1的区别(1.0请求处理完tcp立刻断掉)

Accept text/html, application/xhtml+xml, /
Accept-Encoding gzip, deflate
Accept-Language zh-CN
Cache-Control no-cache
Connection Keep-Alive
Content-Length 31
Content-Type application/x-www-form-urlencoded
Cookie JSESSIONID=119D701F1F634502CBA4A8419A43BD1D
Host localhost:8080
Referer http://localhost:8080/WebPro2/index.jsp
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
请求 POST /WebPro2/servlet/DispatcherDemo HTTP/1.1

请求头
 GET /myweb/index.html HTTP/1.1(请求行)
消息头
 Accept-Encoding gzip, deflate
 Host localhost:8080
 User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
 Accept text/html, application/xhtml+xml, /
 Accept-Language zh-CN
响应头:
 HTTP/1.1 304 Not Modified(状态行)
消息头
 ETag W/“37-1368603309298”
 Content-Type text/html
 Content-Length 37
 Last-Modified Wed, 15 May 2013 07:35:09 GMT
 必须要有一个空行表示消息头结束
 内容
 < font color=“red”>adsfadsfadsf< /font >

 响应头的状态码
 HTTP请求中的常用响应头

Location: http://www.ttt.org/index.jsp
Server:apache tomcat
Content-Encoding: gzip
Content-Length: 80
Content-Language: zh-cn
Content-Type: text/html; charset=GB2312
Last-Modified: Tue, 11 Jul 2000 18:23:51 GMT
Refresh: 1;url=http://www.ttt.org
Content-Disposition: attachment; filename=aaa.zip
Transfer-Encoding: chunked
Set-Cookie:SS=Q0=5Lb_nQ; path=/search
Expires: -1
Cache-Control: no-cache
Pragma: no-cache
Connection: close/Keep-Alive
Date: Tue, 11 Jul 2000 18:23:51 GMT

你可能感兴趣的:(http,http)