ITeye博客

http包协议研究

zzg · 2007-09-04 21:33 · Http · Markdown

用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=1188899343847; rpb_1_0=1188899344037; SINAGLOBAL=210.22.108.98.397911187942276698; SINA_NEWS_CUSTOMIZE_city=%u4E0A%u6D77; vjuids=-1cc3cff55.11496e81190.0.aee5a8a2872e7; vjlast=1188899344; Apache=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. <html>
  18. <head>
  19. <title>上海_天气预报_新浪首页_新浪网title>
  20. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  21. <meta name="Keywords" content="," />
  22. <meta name="Description" content="此页面的说明" />
  23. <style type="text/css">
  24. body{background: #fff;margin:0;}
  25. table,td,img,form{border: none;margin: 0;padding: 0;}
  26. td,p,li,select,input,textarea{font-size:12px;}
  27. a{text-decoration:underline;}
  28. a:link{color:#00007f;}
  29. a:visited{color:#00007f;}
  30. a:active,a:hover{color:#f00;}
  31. -->
  32. style>
  33. head>
  34. <body>
  35. <table width="117" cellspacing="0">
  36. <tr align="left">
  37. <td height="18" valign="middle" align="center"><a href="http://php.weather.sina.com.cn/search.php?city=上海" title="" target="_blank">上海a>
  38. <img src=http://www.sinaimg.cn/dy/weather/images/figure/midrain_small.gif width=14 height=14 alt='中雨' align=absmiddle hspace=3>中雨
  39. td>
  40. tr>
  41. table>
  42. <table width="117" cellspacing="0" style="line-height:19px;">
  43. <tr align="left"><td align=center>26℃~24℃td>
  44. tr>
  45. table>
  46. body>
  47. 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. 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. <HTML>
  8. <HEAD>
  9. <TITLE>Error 404--Not FoundTITLE>
  10. <META NAME="GENERATOR" CONTENT="WebLogic Server">
  11. HEAD>
  12. <BODY bgcolor="white">
  13. <FONT FACE=Helvetica><BR CLEAR=all>
  14. <TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
  15. <FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 404--Not FoundH2>
  16. FONT>TD>TR>
  17. TABLE>
  18. <TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1i>:H3>
  19. FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.5 404 Not FoundH4>
  20. 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>
  21. FONT>TD>TR>
  22. TABLE>
  23. BODY>
  24. 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)

暂无评论。

评论功能维护中,当前仅展示历史评论。