本文介绍了我可以让Fiddler解压缩出站流量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了复制某些用户在我的应用程序中遇到的问题,我需要模拟一个公司代理服务器,该服务器将GZIP的http通信量解压缩,并且在将其传递到目标服务器之前不对其进行重新压缩.用户收到错误消息"GZIP标头中的幻数不正确",我怀疑代理服务器未重新压缩解压缩的GZIP流量.

In order to replicate a problem some users are having with my application, I need to simulate a corporate proxy server which decompresses GZIP'd http traffic and doesn't recompress it before passing it to the destination server. The users are getting the error "the magic number in the GZIP header is incorrect" and it's my suspicion that the proxy server is not re-zipping the decompressed GZIPed traffic.

有没有一种方法可以使用Fiddler进行模拟?具体来说,我认为我需要模拟代理来对主体进行解压缩,也许不必更改标头以使其匹配.

Is there a way I can simulate this using Fiddler? Specifically, I think I need to simulate proxys decompressing the body and perhaps not altering the headers to match.

推荐答案

是的,Fiddler可以以您喜欢的任何方式来操作HTTP请求和响应.

Yes, Fiddler can manipulate the HTTP request and response in any way you like.

首先,请确认您的应用程序GZIP是请求正文.压缩响应非常普遍,但出于多种原因,压缩请求却很少见.

First, please confirm that your application GZIP's the request body. While compressing the response is very common, compressing the request is very uncommon for a number of reasons.

之后,您可以执行以下操作:

After that, you can do the following:

  1. 在Fiddler中,单击Rules> Customize Rules.
  2. 滚动到OnBeforeRequest.
  3. 在方法内,添加以下代码:if (oSession.oRequest.headers.ExistsAndContains("Content-Encoding", "gzip")){ oSession.utilDecodeRequest(); // Decompress request and remove header oSession.oRequest["Content-Encoding"] = "gzip"; // Put header back oSession["ui-backcolor"] = "yellow"; // Mark the session}

  1. In Fiddler, click Rules > Customize Rules.
  2. Scroll to OnBeforeRequest.
  3. Inside the method, add the following code:if (oSession.oRequest.headers.ExistsAndContains("Content-Encoding", "gzip")){ oSession.utilDecodeRequest(); // Decompress request and remove header oSession.oRequest["Content-Encoding"] = "gzip"; // Put header back oSession["ui-backcolor"] = "yellow"; // Mark the session}

保存脚本.

这篇关于我可以让Fiddler解压缩出站流量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 15:48