有没有办法在不把Fiddler变成反向代理的情况下,把用python的httplib发出的HTTPs请求通过Fiddler的代理发送出去?
我尝试使用这个例子(来自here):
import httplib
c = httplib.HTTPSConnection('localhost',8118)
c.set_tunnel('twitter.com',443)
c.request('GET','/')
r1 = c.getresponse()
print r1.status,r1.reason
data1 = r1.read()
print len(data1)但它会返回:
<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><TITLE>Fiddler Echo Service</TITLE></HEAD><BODY STYLE="font-family: arial,sans-serif;"><H1>Fiddler Echo Service</H1><BR /><PRE>GET / HTTP/1.1
Host: localhost:8080
Accept-Encoding: identity
</PRE><BR><HR><UL><LI>To configure Fiddler as a reverse proxy instead of seeing this page, see <A HREF='http://fiddler2.com/r/?REVERSEPROXY'>Reverse Proxy Setup</A><LI>You can download the <a href="FiddlerRoot.cer">FiddlerRoot certificate</A></UL></BODY></HTML>编辑:这段代码可以工作。此问题与Internet Explorer中的代理设置有关。不要在这些设置中设置代理,否则上面的代码将无法工作。
发布于 2012-08-20 22:28:18
我尝试过通过Burp代理使用urllib2 (Proxy with urllib2),它起作用了:
import urllib2
proxy = urllib2.ProxyHandler({'https': '127.0.0.1:8081'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
print urllib2.urlopen('https://www.google.com').read()你的代码在Burp Suite proxy上似乎工作得很好。
https://stackoverflow.com/questions/12038213
复制相似问题