V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
yy030913
V2EX  ›  问与答

江湖救急: git,curl,wget 的请求被重定向到 localhost

  •  
  •   yy030913 · 2016-10-18 03:07:01 +08:00 · 3900 次点击
    这是一个创建于 2996 天前的主题,其中的信息可能已经有所发展或是发生改变。

    git get error $ git clone How people build software · GitHub Cloning into 'xxxx'... fatal: unable to access 'xxx (Michael Dungan) · GitHub': Failed to connect to 127.0.0.1 port 443: Connection refused

    curl also get error $ curl http://baidu.com curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

    wget alseo get error $ wget baidu.com Error parsing proxy URL “ http://127.0.0.1:8123 ”: Scheme missing.

    but ping is ok ping baidu.com PING baidu.com (180.149.132.47): 56 data bytes 64 bytes from 180.149.132.47: icmp_seq=0 ttl=52 time=24.689 ms 64 bytes from 180.149.132.47: icmp_seq=1 ttl=52 time=23.770 ms 64 bytes from 180.149.132.47: icmp_seq=2 ttl=52 time=25.112 ms

    browser is ok

    这个问题困扰一天了,自从写了这段 python 之后就不能用了,怎么重启 mac 都无效,所有代理 vpn 统统都关掉了。

    socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050) socket.socket = socks.socksocket socket.create_connection = create_connection socket.getaddrinfo = getaddrinfo

    不知道套接字这里有没有问题,也贴出来,诚恳请求,江湖救急。深夜 3 点发帖,实在是因为困惑的,蓝瘦,香菇,如果你看到但不知道我说的是什么,请您帮忙点个赞,让这个问题可以被那些传说的神发现,若果你知道一点,也请您不要吝啬,回答出来,因为你在帮助一个已经临近绝望的人

    11 条回复    2016-10-18 17:12:05 +08:00
    yy030913
        1
    yy030913  
    OP
       2016-10-18 03:07:11 +08:00
    netstat
    Active LOCAL (UNIX) domain sockets
    Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
    ac05bb458f74a799 stream 0 0 0 ac05bb458f74af69 0 0 /var/run/mDNSResponder
    ac05bb458f74af69 stream 0 0 0 ac05bb458f74a799 0 0
    ac05bb458f749e39 stream 0 0 0 ac05bb458f749d71 0 0 /var/run/mDNSResponder
    ac05bb458f749d71 stream 0 0 0 ac05bb458f749e39 0 0
    ac05bb4585befdd9 stream 0 0 0 ac05bb4585bef799 0 0 /var/run/mDNSResponder
    ac05bb4585bef799 stream 0 0 0 ac05bb4585befdd9 0 0
    ac05bb4585bef479 stream 0 0 0 ac05bb4585bee7f9 0 0 /var/run/mDNSResponder
    ac05bb4585bee7f9 stream 0 0 0 ac05bb4585bef479 0 0
    ac05bb4585bf00f9 stream 0 0 0 ac05bb4585befea1 0 0 /var/run/mDNSResponder
    ac05bb4585befea1 stream 0 0 0 ac05bb4585bf00f9 0 0
    ac05bb458f749029 stream 0 0 0 ac05bb458f7490f1 0 0 /var/run/mDNSResponder
    ac05bb458f7490f1 stream 0 0 0 ac05bb458f749029 0 0
    ac05bb458a9a1e99 stream 0 0 0 ac05bb458a9a3dd9 0 0 /var/run/mDNSResponder
    ac05bb458a9a3dd9 stream 0 0 0 ac05bb458a9a1e99 0 0
    ac05bb458a9a2b19 stream 0 0 0 ac05bb458ce6cab1 0 0 /var/run/mDNSResponder
    ac05bb458ce6cab1 stream 0 0 0 ac05bb458a9a2b19 0 0
    ac05bb458ce6cb79 stream 0 0 0 ac05bb458ce6cc41 0 0 /var/run/mDNSResponder
    ac05bb458ce6cc41 stream 0 0 0 ac05bb458ce6cb79 0 0
    ac05bb458ce6f991 stream 0 0 0 ac05bb458ce6f8c9 0 0 /var/run/mDNSResponder
    ac05bb458ce6f8c9 stream 0 0 0 ac05bb458ce6f991 0 0
    ac05bb458ce6cd09 stream 0 0 0 ac05bb458ce6f801 0 0 /var/run/mDNSResponder
    ac05bb458ce6f801 stream 0 0 0 ac05bb458ce6cd09 0 0
    ac05bb458ce6cdd1 stream 0 0 0 ac05bb458ce6ce99 0 0 /var/run/mDNSResponder
    ac05bb458ce6ce99 stream 0 0 0 ac05bb458ce6cdd1 0 0
    ac05bb458ce6f739 stream 0 0 0 ac05bb458ce6f671 0 0 /var/run/mDNSResponder
    ac05bb458ce6f671 stream 0 0 0 ac05bb458ce6f739 0 0
    ac05bb458ce6cf61 stream 0 0 0 ac05bb458ce6f5a9 0 0 /var/run/mDNSResponder
    ac05bb458ce6f5a9 stream 0 0 0 ac05bb458ce6cf61 0 0
    ac05bb458ce6f4e1 stream 0 0 0 ac05bb458ce6f419 0 0 /var/run/usbmuxd
    ac05bb458ce6f419 stream 0 0 0 ac05bb458ce6f4e1 0 0
    ac05bb458ce6f289 stream 0 0 0 ac05bb458ce6f1c1 0 0 /var/run/usbmuxd
    ac05bb458ce6f1c1 stream 0 0 0 ac05bb458ce6f289 0 0
    ac05bb458ce6edd9 stream 0 0 0 ac05bb458ce6ed11 0 0 /var/run/mDNSResponder
    ac05bb458ce6ed11 stream 0 0 0 ac05bb458ce6edd9 0 0
    ac05bb458ce6e2e9 stream 0 0 0 ac05bb458a9a1ab1 0 0 /var/run/mDNSResponder
    ac05bb458a9a1ab1 stream 0 0 0 ac05bb458ce6e2e9 0 0
    ac05bb458a9a3f69 stream 0 0 0 ac05bb458a9a3ea1 0 0 /var/run/mDNSResponder
    ac05bb458a9a3ea1 stream 0 0 0 ac05bb458a9a3f69 0 0
    ac05bb458a9a28c1 stream 0 0 0 ac05bb458a9a2989 0 0 /var/run/mDNSResponder
    ac05bb458a9a2989 stream 0 0 0 ac05bb458a9a28c1 0 0
    ac05bb458a9a3221 stream 0 0 0 ac05bb458a9a36d1 0 0
    ac05bb458a9a36d1 stream 0 0 0 ac05bb458a9a3221 0 0
    ac05bb458a9a3609 stream 0 0 0 ac05bb458a9a3541 0 0
    ac05bb458a9a3541 stream 0 0 0 ac05bb458a9a3609 0 0
    ac05bb458a9a3479 stream 0 0 0 ac05bb458a9a33b1 0 0
    ac05bb458a9a33b1 stream 0 0 0 ac05bb458a9a3479 0 0
    ac05bb458a9a32e9 stream 0 0 0 ac05bb4585b1e991 0 0
    ac05bb4585b1e991 stream 0 0 0 ac05bb458a9a32e9 0 0
    ac05bb4585b1e801 stream 0 0 0 ac05bb4585b1bab1 0 0 /var/run/mDNSResponder
    ac05bb4585b1bab1 stream 0 0 0 ac05bb4585b1e801 0 0
    ac05bb4585b1bdd1 stream 0 0 0 ac05bb4585b1be99 0 0 /var/run/mDNSResponder
    ac05bb4585b1be99 stream 0 0 0 ac05bb4585b1bdd1 0 0
    ac05bb4585b1c029 stream 0 0 ac05bb4589859d99 0 0 0 /usr/local/var/run/watchman/xiaoyu-state/sock
    ac05bb4585b1e5a9 stream 0 0 ac05bb4589826651 0 0 0 /private/tmp/com.apple.launchd.756DiLdZ4a/org.macosforge.xquartz:0
    ac05bb4585b1c0f1 stream 0 0 ac05bb45897eaba9 0 0 0 /private/tmp/com.apple.launchd.YoDsKZh3Pl/Listeners
    ac05bb4585b1e4e1 stream 0 0 ac05bb45897ec7c1 0 0 0 /private/tmp/com.apple.launchd.wUqyG4QPnw/Render
    ac05bb4585b1e351 stream 0 0 ac05bb45897ec6c9 0 0 0 /var/tmp/filesystemui.socket
    ac05bb4585b1e289 stream 0 0 0 ac05bb4585b1c1b9 0 0 /var/run/mDNSResponder
    ac05bb4585b1c1b9 stream 0 0 0 ac05bb4585b1e289 0 0
    ac05bb4585b1e1c1 stream 0 0 0 ac05bb4585b1c281 0 0 /var/run/mDNSResponder
    ac05bb4585b1c281 stream 0 0 0 ac05bb4585b1e1c1 0 0
    ac05bb4585b1e0f9 stream 0 0 ac05bb4588d2d9b1 0 0 0 /var/run/.sim_diagnosticd_socket
    ac05bb4585b1df69 stream 0 0 0 ac05bb4585b1e031 0 0 /var/run/mDNSResponder
    ac05bb4585b1e031 stream 0 0 0 ac05bb4585b1df69 0 0
    ac05bb4585b1c669 stream 0 0 0 ac05bb4585b1c7f9 0 0
    ac05bb4585b1c7f9 stream 0 0 0 ac05bb4585b1c669 0 0
    ac05bb4585b1ca51 stream 0 0 ac05bb4586a62d19 0 0 0 /var/run/pppconfd
    ac05bb4585b1d861 stream 0 0 ac05bb4585cb4c21 0 0 0 /private/var/run/cupsd
    ac05bb4585b1cca9 stream 0 0 ac05bb4585ca05d1 0 0 0 /var/run/usbmuxd
    ac05bb4585b1d799 stream 0 0 ac05bb4585c8fca1 0 0 0 /var/run/systemkeychaincheck.socket
    ac05bb4585b1d6d1 stream 0 0 ac05bb4585c7c7c1 0 0 0 /var/run/portmap.socket
    ac05bb4585b1cd71 stream 0 0 ac05bb4585c7aba9 0 0 0 /var/run/vpncontrol.sock
    ac05bb4585b1d609 stream 0 0 ac05bb4585c747c1 0 0 0 /var/rpc/ncacn_np/wkssvc
    ac05bb4585b1ce39 stream 0 0 ac05bb4585c72e91 0 0 0 /var/rpc/ncalrpc/wkssvc
    ac05bb4585b1d541 stream 0 0 ac05bb4585c72f89 0 0 0 /var/rpc/ncacn_np/mdssvc
    ac05bb4585b1d479 stream 0 0 ac05bb4585c746c9 0 0 0 /var/rpc/ncacn_np/lsarpc
    ac05bb4585b1d3b1 stream 0 0 ac05bb4585c73081 0 0 0 /var/rpc/ncalrpc/lsarpc
    ac05bb4585b1cf01 stream 0 0 ac05bb4585c73749 0 0 0 /var/rpc/ncacn_np/srvsvc
    ac05bb4585b1cfc9 stream 0 0 ac05bb4585c740f9 0 0 0 /var/rpc/ncalrpc/srvsvc
    ac05bb4585b1d091 stream 0 0 ac05bb4585c62ca1 0 0 0 /var/rpc/ncalrpc/NETLOGON
    ac05bb4585b1d2e9 stream 0 0 ac05bb4585c643e1 0 0
    kslr
        2
    kslr  
       2016-10-18 06:06:01 +08:00
    直接 socks.setdefaultproxy() 应该可以恢复
    liuzuo
        3
    liuzuo  
       2016-10-18 06:22:05 +08:00 via Android
    有代理,检查一下吧
    jackyspy
        4
    jackyspy  
       2016-10-18 08:27:40 +08:00   ❤️ 1
    看下环境变量有没有 http_proxy 和 https_proxy 。
    socks.setdefaultproxy 是第三方模块,看看代码都改了些什么。
    8123 端口可能是 privoxy 或者 polipo 之类的代理。
    yy030913
        5
    yy030913  
    OP
       2016-10-18 09:27:14 +08:00
    @kslr 非常感谢,不行的
    yy030913
        6
    yy030913  
    OP
       2016-10-18 09:32:27 +08:00
    @liuzuo 我用 Polipo 做的代理,已经关闭,并且重启也没有效果
    yy030913
        7
    yy030913  
    OP
       2016-10-18 09:45:51 +08:00
    @jackyspy 厉害,忘记自己改过 base_profile ,
    #export http_proxy=“ http://127.0.0.1:8123 ”
    #export https_proxy=“ http://127.0.0.1:8123 ”
    #export ftp_proxy=“ http://127.0.0.1:8123 ”
    export no_proxy=“ localhost,127.0.0.1,localaddress ”
    #export HTTP_PROXY=” http://127.0.0.1:8123/”

    #export HTTPS_PROXY=” http://127.0.0.1:8123/”

    #export FTP_PROXY=” http://127.0.0.1:8123/”

    export NO_PROXY=” localhost,127.0.0.1,localaddress ”
    已经删除,现在重启新的 terminal 已经可用了,(可是在旧的 terminal 中为什么还是报错呢)
    yttyhf2006
        8
    yttyhf2006  
       2016-10-18 11:02:34 +08:00 via Android
    @yy030913 旧的需要 unset 相关变量
    jackyspy
        9
    jackyspy  
       2016-10-18 13:06:47 +08:00
    @yy030913 修改 profile ,原来的 terminal 需要重新 source
    `. ~/.bash_profile`
    yy030913
        10
    yy030913  
    OP
       2016-10-18 17:10:40 +08:00
    @jackyspy 当时就是在旧的 terminal 中 source ~/.bash_profile 的,奇怪当时没有起作用。你有自己的网站吗?希望和你多多学习
    yy030913
        11
    yy030913  
    OP
       2016-10-18 17:12:05 +08:00
    @yttyhf2006 你是说
    unset no_proxy
    unset NO_PROXY
    这样做吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1005 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:41 · PVG 05:41 · LAX 13:41 · JFK 16:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.