Curl 没有 return 任何东西
Curl doesn't return anything
我在 A.B.C.D:5601 托管了一个网络应用程序,当我尝试 curl A.B.C.D:5601
时,它不会在屏幕上打印出任何内容,但是当我打开相同的 link 使用一个浏览器,它确实打开了 webapp。但它被转发到 A.B.C.D:5601/foo/bar
并且打开正常。
这是curl -v
的输出
* Trying A.B.C.D:5601...
* TCP_NODELAY set
* Connected to A.B.C.D port 5601 (#0)
> GET / HTTP/1.1
> Host: A.B.C.D:5601
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< location: /spaces/enter
< x-content-type-options: nosniff
< referrer-policy: no-referrer-when-downgrade
< cache-control: private, no-cache, no-store, must-revalidate
< content-length: 0
< Date: Tue, 08 Jun 2021 03:01:11 GMT
< Connection: keep-alive
< Keep-Alive: timeout=120
<
* Connection #0 to host A.B.C.D left intact
为什么 curl 不给我回复?
Curl 告诉您您正在被重定向到 /spaces/enter
。
您可以让 Curl 自动跟随重定向:
curl -vL [url]
我在 A.B.C.D:5601 托管了一个网络应用程序,当我尝试 curl A.B.C.D:5601
时,它不会在屏幕上打印出任何内容,但是当我打开相同的 link 使用一个浏览器,它确实打开了 webapp。但它被转发到 A.B.C.D:5601/foo/bar
并且打开正常。
这是curl -v
* Trying A.B.C.D:5601...
* TCP_NODELAY set
* Connected to A.B.C.D port 5601 (#0)
> GET / HTTP/1.1
> Host: A.B.C.D:5601
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< location: /spaces/enter
< x-content-type-options: nosniff
< referrer-policy: no-referrer-when-downgrade
< cache-control: private, no-cache, no-store, must-revalidate
< content-length: 0
< Date: Tue, 08 Jun 2021 03:01:11 GMT
< Connection: keep-alive
< Keep-Alive: timeout=120
<
* Connection #0 to host A.B.C.D left intact
为什么 curl 不给我回复?
Curl 告诉您您正在被重定向到 /spaces/enter
。
您可以让 Curl 自动跟随重定向:
curl -vL [url]