如何通过本地代理允许curl?

cwd*_*cwd 8 linux macos proxy curl http

根据Charles Proxy配置页面,如果您将localhost与端口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
Run Code Online (Sandbox Code Playgroud)

我可以在Web浏览器中连接到localhost:8080,并将结果记录在代理中.但是这不起作用,连接被拒绝,没有记录任何内容.

到目前为止我还尝试过:

- executing this as root
- using 127.0.0.1 instead of localhost
- using wget instead of curl
- disabling the system firewall
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?我还能尝试什么?

rrr*_*hys 18

我使用端口8888取得了一些成功: curl http://www.google.com --proxy 127.0.0.1:8888


Mar*_*c B 3

连接被拒绝表明没有任何内容正在侦听端口 8080。Charles 必须运行(并侦听端口 8080),curl 才能将其用作代理。或者您的防火墙主动阻止该端口,从而阻止任何连接。