2011-09-19 72 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