为什么 curl 似乎无法在代理后面工作?

为什么 curl 似乎无法在代理后面工作?

当通过代理使用 curl 时,

curl -O -fsSL https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg -v -k -x http://xxx.xxx.xxx.xxx:8080

我遇到了如下错误。我该如何解决?

Trying xxx.xxx.xxx.xxx...
TCP_NODELAY set
Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 8080 (#0)
Establish HTTP proxy tunnel to storage.googleapis.com:443
CONNECT storage.googleapis.com:443 HTTP/1.1
Host: storage.googleapis.com:443
User-Agent: curl/7.54.0
Proxy-Connection: Keep-Alive

HTTP/1.0 403 Forbidden
Server: squid
Mime-Version: 1.0
Date: Sun, 13 Jan 2019 16:33:30 GMT
Content-Type: text/html
Content-Length: 3149
X-Squid-Error: ERR_ACCESS_DENIED 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from unknown
X-Cache-Lookup: NONE from unknown:8080
Via: 1.0 unknown (squid)
Connection: keep-alive

The requested URL returned error: 403
Connection #0 to host xxx.xxx.xxx.xxx left intact
curl: (22) The requested URL returned error: 403

我还尝试了一些其他的东西……

  1. 无需代理,它就能工作......

    curl -O -fsSL https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg -v -k
    
  2. 当使用下面的代理访问一个特定的 URL 时,它可以工作......

    curl -O -fsSL https://get.docker.com/gpg -v -k -x http://xxx.xxx.xxx.xxx:8080
    
    SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
    ALPN, server accepted to use http/1.1
    Server certificate:
     subject: CN=*.docker.com
     start date: Jul 30 00:00:00 2018 GMT
     expire date: Aug 30 12:00:00 2019 GMT
     issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
     SSL certificate verify ok.
    GET /gpg HTTP/1.0
    Host: get.docker.com
    User-Agent: curl/7.54.0
    Accept: */*
    
    HTTP/1.1 200 OK
    Content-Type: binary/octet-stream
    Content-Length: 975
    Connection: close
    Date: Thu, 03 Jan 2019 02:11:40 GMT
    Last-Modified: Tue, 16 Oct 2018 22:59:33 GMT
    x-amz-version-id: JhVckjyzQEkrDSsxn3RySEOXcybUYG7B
    ETag: "5be321089b71e829affab91dd5d5cd3f"
    Server: AmazonS3
    Age: 856
    X-Cache: Hit from cloudfront
    Via: 1.1 a8f6d439d4b35a734e48cf0ced363c2d.cloudfront.net (CloudFront)
    X-Amz-Cf-Id: 07fsnwsaA-9G6q5peUxScboc7l1y5Bov_t5vys0Fp6msPMt9oaXQ2w==
    
  3. 当使用代理访问其他 URL 时,它会返回相同的错误。

    curl -O -fsSL https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png -v -k -x http://xxx.xxx.xxx.xxx:8080
    Connection #0 to host 10.132.2.6 left intact
    curl: (22) The requested URL returned error: 403
    
  4. -v4添加了诸如、、或之-v6类的选项,但并没有解决问题。--http1.0--http2.0

相关内容