小编Abd*_*kli的帖子

cURL 可以检测 307 响应吗?

为了我的研究,我需要 cURL fqdn 并获取它们的状态代码。(对于 Http、Https 服务)但是有些 http url 以 https 的形式打开,尽管它使用 cURL 返回 200。(请求成功,无重定向)

curl -I  http://example.example.com/
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 22 Nov 2021 10:43:32 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 64991
Connection: keep-alive
Keep-Alive: timeout=20
Vary: Accept-Encoding
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Link: <https://example.example.com/>; rel=shortlink
X-Powered-By: WP Engine
X-Cacheable: SHORT
Vary: Accept-Encoding,Cookie
Cache-Control: max-age=600, must-revalidate
X-Cache: HIT: 10
X-Cache-Group: normal
Accept-Ranges: bytes
Run Code Online (Sandbox Code Playgroud)

如上所示,我收到了 200 个带有curl 请求的响应。但我可以在浏览器中看到 307 代码。(如下图所示)

Request URL: http://example.example.com/
Request Method: …
Run Code Online (Sandbox Code Playgroud)

https curl http httpresponse

13
推荐指数
2
解决办法
1万
查看次数

标签 统计

curl ×1

http ×1

httpresponse ×1

https ×1