curl -i http://ip.cn 301 永久移动

curl -i http://ip.cn 301 Moved Permanently

我看了一个article,里面提到了一个网络测试方法

预期结果:

实际结果:

curl -i http://ip.cn

HTTP/1.1 301 Moved Permanently
Date: Tue, 18 Feb 2020 09:16:12 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Tue, 18 Feb 2020 10:16:12 GMT
Location: https://ip.cn/
Alt-Svc: h3-25=":443"; ma=86400, h3-24=":443"; ma=86400, h3-23=":443"; ma=86400
Server: cloudflare
CF-RAY: 566ee6a159a9d96a-HKG

更新:

感谢您的回答,有效。

这是符合预期的测试结果

➜  work git:(master) ✗ curl -i https://ip.cn
HTTP/2 200
date: Tue, 18 Feb 2020 10:12:29 GMT
content-type: application/json; charset=UTF-8
set-cookie: __cfduid=de415094860b360bfae3d5903804244451582020749; expires=Thu, 19-Mar-20 10:12:29 GMT; path=/; domain=.ip.cn; HttpOnly; SameSite=Lax
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
alt-svc: h3-25=":443"; ma=86400, h3-24=":443"; ma=86400, h3-23=":443"; ma=86400
server: cloudflare
cf-ray: 566f39135e2feb61-LAX


{"ip": "124.64.19.119", "country": "北京市", "city": "联通”}



➜  work git:(master) ✗ export ALL_PROXY=socks5://127.0.0.1:1086



➜  work git:(master) ✗ curl -i https://ip.cn
HTTP/2 200
date: Tue, 18 Feb 2020 10:13:34 GMT
content-type: application/json; charset=UTF-8
set-cookie: __cfduid=d59e4719e6efbfddb9fd408db5c8d415f1582020814; expires=Thu, 19-Mar-20 10:13:34 GMT; path=/; domain=.ip.cn; HttpOnly; SameSite=Lax
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
alt-svc: h3-25=":443"; ma=86400, h3-24=":443"; ma=86400, h3-23=":443"; ma=86400
server: cloudflare
cf-ray: 566f3aa8bdc9d942-HKG


{"ip": "112.119.149.55", "country": "香港特别行政区", "city": "电讯盈科"}

后续问题:

但是还是下载不了android项目的依赖

gongzelong:android gongzelong$ ./gradlew build

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.google.gms:google-services:4.3.3.
     Required by:
         project :
      > Could not resolve com.google.gms:google-services:4.3.3.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
            > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
               > Read timed out

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 30s

它希望您使用 HTTPS 版本,因此它会发回重定向响应。在命令行中添加 -L 或在 URL...

中使用 https://