2011-09-19 20 views
7

根据该Charles Proxy configuration page,您可以手动设置代理,如果您使用本地主机与端口8080如何通过本地代理实现卷曲?

语法curl --proxy localhost:8080 http://google.com/

然而,这不是为我工作。下面是我的语法和结果 - 我还使用了-v选项进行调试:

curl -v --proxy localhost:8080 http://google.com/ 

* About to connect() to proxy localhost port 8080 (#0) 
* Trying 127.0.0.1... Connection refused 
* Trying ::1... Connection refused 
* Trying fe80::1... Connection refused 
* couldn't connect to host 
* Closing connection #0 
curl: (7) couldn't connect to host 

我可以连接到本地主机:8080在Web浏览器,并将结果记录在代理。然而,这不起作用,连接被拒绝并且没有记录。

到目前为止,我也曾尝试:

- executing this as root 
- using 127.0.0.1 instead of localhost 
- using wget instead of curl 
- disabling the system firewall 

我在做什么错?我还能尝试什么?

+0

连接端口8080上的查尔斯听处于运行状态(和侦听端口8080)的卷曲,以便能够使用它作为一个代理。或者你有防火墙主动阻止该端口,阻止任何连接。 –

+0

太棒了。我想我的决定使用端口8888来代替。如果您发表评论作为答案,我会接受它。谢谢。 – cwd

回答

3

拒绝连接会提示没有任何内容在端口8080上进行侦听。Charles必须运行(并监听端口8080),以便curl能够将其用作代理。或者你有防火墙主动阻止该端口,阻止任何连接。

15

我不得不使用8888端口了一定的成功: 拒绝会建议什么curl http://www.google.com --proxy 127.0.0.1:8888