http包协议研究

用IEInspector抓的http包:
参考http1.1协议,http://www.cnpaf.net/Class/HTTP/0772522080738754597.html

1.其中的一个ruquest包stream
xml 代码
 
  1. GET http://www.sina.com.cn/iframe/2006/weather/310100.html HTTP/1.1  
  2. Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*  
  3. Referer: http://www.sina.com.cn/  
  4. Accept-Language: zh-cn  
  5. UA-CPU: x86  
  6. Accept-Encoding: gzip, deflate  
  7. If-Modified-Since: Tue, 04 Sep 2007 01:59:52 GMT  
  8. If-None-Match: "a1911b-45f-a5153600"  
  9. User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)  
  10. Proxy-Connection: Keep-Alive  
  11. Host: www.sina.com.cn  
  12. Pragma: no-cache  
  13. Cookie: sinaGlobalRotator_http%3A//www.sina.com.cn/=26; rdl_1_1=1188899343847rpb_1_0=1188899344037SINAGLOBAL=210.22.108.98.397911187942276698; SINA_NEWS_CUSTOMIZE_city=%u4E0A%u6D77; vjuids=-1cc3cff55.11496e81190.0.aee5a8a2872e7; vjlast=1188899344Apache=210.22.108.98.296031188899335707  

2.response相应的包stream
xml 代码
 
  1. HTTP/1.1 200 OK  
  2. Via: 1.0 HDQSPROXYS01  
  3. Connection: Keep-Alive  
  4. Proxy-Connection: Keep-Alive  
  5. Content-Length: 1119  
  6. Expires: Tue, 04 Sep 2007 09:52:41 GMT  
  7. Date: Tue, 04 Sep 2007 09:50:41 GMT  
  8. Content-Type: text/html  
  9. ETag: "e0791c-45f-a5153600"  
  10. Server: Apache/2.0.54 (Unix)  
  11. Last-Modified: Tue, 04 Sep 2007 01:59:52 GMT  
  12. Accept-Ranges: bytes  
  13. Cache-Control: max-age=120  
  14. Vary: Accept-Encoding  
  15. X-Cache: MISS from 152-77.sina.com.cn  
  16. nnCoection: close  
  17.   
  18.   
  19. <html>  
  20. <head>  
  21. <title>上海_天气预报_新浪首页_新浪网title>  
  22. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  23. <meta name="Keywords" content="," />  
  24. <meta name="Description" content="此页面的说明" />  
  25. <style type="text/css">  
  26. body{background: #fff;margin:0;}  
  27. table,td,img,form{border: none;margin: 0;padding: 0;}  
  28. td,p,li,select,input,textarea{font-size:12px;}  
  29. a{text-decoration:underline;}  
  30. a:link{color:#00007f;}  
  31. a:visited{color:#00007f;}  
  32. a:active,a:hover{color:#f00;}  
  33. -->  
  34. style>  
  35. head>  
  36. <body>  
  37.   
  38. <table width="117" cellspacing="0">  
  39. <tr align="left">  
  40. <td height="18" valign="middle" align="center"><a href="http://php.weather.sina.com.cn/search.php?city=上海" title="" target="_blank">上海a>  
  41. <img src=http://www.sinaimg.cn/dy/weather/images/figure/midrain_small.gif width=14 height=14 alt='中雨' align=absmiddle hspace=3>中雨  
  42. td>  
  43. tr>  
  44. table>  
  45. <table width="117" cellspacing="0" style="line-height:19px;">  
  46. <tr align="left"><td align=center>26℃~24℃td>  
  47. tr>  
  48. table>  
  49.   
  50.   
  51. body>  
  52. html>  


3.相应图片的response流
xml 代码
 
  1. HTTP/1.1 200 OK  
  2. Via: 1.1 HDQSPROXYS01  
  3. Connection: Keep-Alive  
  4. Proxy-Connection: Keep-Alive  
  5. Content-Length: 35  
  6. Expires: Sun, 04 Jul 2004 00:04:00 GMT  
  7. Date: Tue, 04 Sep 2007 09:50:40 GMT  
  8. Content-Type: image/gif  
  9. Server: Apache  
  10. Set-Cookie: vjsid=210.22.108.98.1188899440558079; path=/; expires=Thu, 03-Sep-37 21:50:40 GMT; domain=.wrating.com  
  11. Accept-Ranges: bytes  
  12. Pragma: no-cache  
  13. Cache-Control: no-cache  
  14.   
  15. GIF89a  



4.报404时候
xml 代码
 
  1. HTTP/1.1 404 Not Found  
  2. Date: Tue, 04 Sep 2007 18:00:14 GMT  
  3. Content-Length: 1214  
  4. Content-Type: text/html  
  5. Connection: Close  
  6.   
  7. >  
  8. <HTML>  
  9. <HEAD>  
  10. <TITLE>Error 404--Not FoundTITLE>  
  11. <META NAME="GENERATOR" CONTENT="WebLogic Server">  
  12. HEAD>  
  13. <BODY bgcolor="white">  
  14. <FONT FACE=Helvetica><BR CLEAR=all>  
  15. <TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>  
  16. <FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 404--Not FoundH2>  
  17. FONT>TD>TR>  
  18. TABLE>  
  19. <TABLE border=0 width=100cellpadding=10><TR><TD VALIGN=top WIDTH=100BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1i>:H3>  
  20. FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.5 404 Not FoundH4>  
  21. FONT><P><FONT FACE="Courier New">The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.p><p>If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.FONT>P>  
  22. FONT>TD>TR>  
  23. TABLE>  
  24.   
  25. BODY>  
  26. HTML>  


5.post时的数据包
xml 代码
 
  1. POST /es/logging.do?method=logon HTTP/1.1  
  2. Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*  
  3. Referer: http://localhost:8080/es/logging.do?method=toLogon  
  4. Accept-Language: zh-cn  
  5. Content-Type: application/x-www-form-urlencoded  
  6. UA-CPU: x86  
  7. Accept-Encoding: gzip, deflate  
  8. User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)  
  9. Host: localhost:8080  
  10. Content-Length: 57  
  11. Connection: Keep-Alive  
  12. Cache-Control: no-cache  
  13. Cookie: JSESSIONID=AE72735A180C654A598B19E2F000FB26  
  14. logonName=admin&password=111111&Submit=%E7%99%BB%E5%BD%95  





请求包
xml 代码
  1. Accept        接收  
  2. Referer        提交者  
  3. Accept-Language    接收语言  
  4. Accept-Encoding 接收编码  
  5. UA-CPU        用户cpu  
  6. If-Modified-Since假如修改  
  7. If-None-Match    假如不匹  
  8. User-Agent    用户代理  
  9. Proxy-Connection代理连接  
  10. Host        主机  
  11. Pragma        缓存  


回应包
xml 代码
 
  1. via        路由  
  2. Content-Length    内容长度  
  3. Expires        过期  
  4. Date        日期  
  5. Content-Type    内容类型  
  6. ETag        应答报头域提供了请求变量的当前实体标签。  
  7. Server        服务器类型  
  8. Last-Modified    最后修改,一缓存条目在最后修改期后未经修改则被认为是有效的.  
  9. Accept-Ranges    接收范围  
  10. Cache-Control    缓存控制max-age=120,最大时限(秒)  
  11. Vary        更正  
  12. X-Cache        表示你的 http request 是由 proxy server 回的MISS 表 proxy 無資料,代理動作, HIT 表 proxy 直接回應  
  13. nnCoection  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值