惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Martin Fowler
Martin Fowler
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
C
Check Point Blog
H
Help Net Security
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
P
Proofpoint News Feed
V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
S
SegmentFault 最新的问题
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
博客园_首页
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏

博客园 - peak

windows 服务器时间同步失败处理方法 利用批处理自动创建schtasks系统任务 抓取网站编码信息及内容 jquery跨域调用WCF Base-64 字符串中的无效字符 Ie7下鼠标滚轮失效 Android 笔记二(取得根目录权限) Android 笔记一 捕获asp.net ValidationSummary 控件消息。 - peak Sql Split 函数 Rss的浏览器之痛 兼容IE,Firefox 图片即时显示 asp.net 中插入flash - peak - 博客园 迷茫 windows service 之访问权限 windows Service 之调试过程 比尔盖兹在某个大学毕业典礼上的演讲中,对毕业生提出十一项极为睿智的人生建议 MSDN上关于泛型的例子 泛型
在线调试利器Fiddler AutoResponse
peak · 2012-01-19 · via 博客园 - peak

      有些时候在测试环境和线上环境的不同,导致在线系统的js难易跟踪调试特别是一些动态js脚本。fiddler这个工具给我减少了很多调试上的烦恼,尤其是强大的AutoResponder.

它可以抓取在线页面保存到本地进行调试,这大大减少了在线调试的困难。

下面以http://www.fiddler2.com/fiddler2为例简单描述一下操作步骤:

1、打开fiddler2,在浏览器中输入http://www.fiddler2.com/fiddler2。在fiddler2可以看到请求记录。

2、选择需要调试的页面,右键-Save-Response-Response body

3、修改需要调试的代码段。

4、点击fiddler AutoResponder Tab页面,勾选Enable automatic responses,把http://www.fiddler2.com/fiddler2/这面拖拽到AutoResponder 列表中。

    默认 Rule Editor为精匹配。在第二个文本框中选择Find a file...,选择本地保存后的文件。

5、保存规则后,重新请求http://www.fiddler2.com/fiddler2/,在看Fiddler websessions 列表新的请求Result 301,说明请求的是本地缓存的文件。

这样就可以做我们想做的调试和修改了。

如果,你的请求是带动态参数的化,可以使用正则表达式。

如:请求规则:Regex:(?insx)^http://.*gravatar.*$

                   Regex:(?insx)^http://.*WF_ID=WFDevFx_GCUSTOMIZE&ticket=.*$

*下面是详细的过滤规则:

String Literals

Fiddler will match string literals (大小写不敏感)

Rule

Matches

*

http://www.example.com/Path1/query=example

EXAMPLE

http://www.example.com/Path1/query=example

path1/

http://www.example.com/Path1/query=example

query

http://www.example.com/Path1/q=Query

Exact Match(精确匹配)

Fiddler supports an exact, 大小写敏感 match syntax for expressions which begin with exact:

Rule

Matches

EXACT:http://www.example.com/path

http://www.example.com/path

EXACT:http://www.example.com/path

http://www.example.com/Path (No Match - mismatched case)

EXACT:http://www.example.com/path

http://www.example.com/path/q=Query (No Match - substring different)

Regular Expressions(正则表达式)

Fiddler supports regular expression syntax for expressions which begin with regex:

Rule

Matches

regex:.*

http://www.example.com/Path1/query=example

regex:.*\.jpg

http://www.example.com/Path1/query=foo.jpg&bar
http://www.example.com/Path1/query=example.jpg

regex:.*\.jpg$

http://www.example.com/Path1/query=foo.jpg&bar (No Match - improper ending)
http://www.example.com/Path1/query=example.jpg

regex:.*\.(jpg|gif|bmp)$

http://www.example.com/Path1/query=foo.bmp&bar (No Match  - improper ending)
http://www.example.com/Path1/query=example.gif
http://www.example.com/Path1/query=example.Gif  (No Match - mismatched case)
http://www.example.com/Path1/query=example.bmp

regex:(?insx).*\.(jpg|gif|bmp)$

http://www.example.com/Path1/query=foo.bmp&bar (No Match - improper ending)
http://www.example.com/Path1/query=example.gif
http://www.example.com/Path1/query=example.Gif 
http://www.example.com/Path1/query=example.bmp

 抓取带参数的请求并重定向:

  请求:http://v.sdo.com/login/game_login.htm?isgamelogin=true&server=1&abb=csws&returnUrl=%2fcsws%2fplay.htm

      重定向:http://www.cnblogs.com/peak-weng/archive/2012/01/19/2325855.html?isgamelogin=true&server=1&abb=csws&returnUrl=%2fcsws%2fplay.htm

     在Rule Editor:表示为:

      regex:(?insx)^http://v.sdo.com/login/game_login.htm\?(?<args>.*)$

      *redir: http://www.cnblogs.com/peak-weng/archive/2012/01/19/2325855.html?${args}

  如图:

     

参考文章:http://aiyooyoo.com/index.php/archives/250/