【问题标题】:Checking if site is available using shell and curl for https URL redirect使用 shell 和 curl 检查站点是否可用以进行 https URL 重定向
【发布时间】:2014-03-01 16:51:45
【问题描述】:

我想检查https://fusionhelp.oracle.com 网站是否可用。浏览完本站的帖子后,尝试在 linux 命令提示符下使用curl 脚本,如下所示:

curl https://fusionhelp.oracle.com -L -o dumpfile -w 'Last URL was: %{url_effective}'

curl -vi -I -L --cacert FusionhelpRepository https-fusionhelp-website

FusionhelpRepository 包含合并到一个文件中的安全 certificates.pem

我得到 curl: (7) socket error: 113 ,而不是表明该网站可用的状态代码。我希望第一个响应是 302,之后它应该被重定向到目标页面。

我知道之前已经发布了许多此类帖子,并且该解决方案适用于我一直在访问的 Yahoo、Google 或其他 HTTPS 网站。这个没有通过。

【问题讨论】:

    标签: shell curl https


    【解决方案1】:

    我认为你只需要 -I 选项:

    curl -I https://fusionhelp.oracle.com
    

    这将给出响应代码,当前显示 503 Service Unavailable。

    【讨论】:

    • 这正是问题所在。当网站可用时,它说服务不可用。为什么我们会得到那个错误代码,以及得到 200 个代码的出路是什么
    • 似乎他们故意为 curl 请求返回 503 - 至少是我的猜测。
    猜你喜欢
    • 1970-01-01
    • 2014-04-05
    • 1970-01-01
    • 2012-12-19
    • 2017-07-15
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    • 2021-03-29
    相关资源
    最近更新 更多