我已经在使用 Fiddler 拦截特定远程文件的请求,以便在处理它们时进行本地调整而不会触及发布的内容。
例如,我使用很多类似这样的规则:
match: regex:(?insx).+/some_file([?a-z0-9-=&]+\.)*
respond: c:\somepath\some_file
这个很完美。
现在我想更进一步,做类似于这样的事情
match: regex:http://some_dummy_domain/(anything)?(anything)
respond: c:\somepath\(anything)?(anything)
或者,以普通文本形式,
截取任何对“some_dummy_domain”的http请求,进入“c:\ somepath”并获取原始请求的路径和名称相同的文件。 查询字符串应通过。
一些情况进一步澄清:
http://some_domain/somefile --> c:\somepath\somefile
http://some_domain/path1/somefile --> c:\somepath\path1\somefile
http://some_domain/path1/somefile?querystring --> c:\somepath\path1\somefile?querystring
我尝试利用我已有的资源:
match: regex:(?insx).+//some_dummy_domain/([?a-z0-9-=&]+\.)*
respond: ...
基本上,我正在寻找请求中的//some_dummy_domain/
。测试时似乎匹配正确,但是我不知道如何回复。
Fiddler能否在响应中使用匹配项,我该如何正确设置?
我尝试回复c:\somepath\$1
,但Fiddler似乎按照字面意思处理它:
match: regex:(?insx).+//some_domain/([?a-z0-9-=&]+\.)*
respond: c:\somepath\$1
request: http://some_domain/index.html
response: c:\somepath\$1html <-----------
\1
,$1
等吗? - Lucas Trzesniewski