我正在使用 mitmproxy 来拦截流量。我想要的是能够在一个字符串中获取整个请求和响应。我知道你有def response(context, flow)
并且 HTTPFlow 对象有请求和响应对象。我想要的只是字符串中的类似内容
GET http://www.google-analytics.com/collect?v=1& HTTP/1.1
Header 1: value
Header 2: value
request body
和这个
HTTP/1.1 301 Moved Permanently
Header 1: value
Header 2: value
response body
现在我一直在尝试通过连接请求和响应的不同部分和位来尝试这个,但这很容易出错。有一个更好的方法吗?
此外,mitm 是否处理 Gzip 编码的响应体?