【问题标题】:400 Bad Request installing Perlbrew itself400 Bad Request 安装 Perlbrew 本身
【发布时间】:2014-06-20 09:08:12
【问题描述】:

我无法使用简单脚本安装 Perlbrew:curl -L http://install.perlbrew.pl | bash

我以前很容易做到,但现在,在全新的 CentOS 6.5 中,我收到 400 Bad Request。

这是输出:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
113   226  113   226    0     0    187      0  0:00:01  0:00:01 --:--:--   187
bash: line 1: syntax error near unexpected token `newline'
bash: line 1: `<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'

如果我执行 curl 部分(不将其传递给 bash),这就是响应

curl -L http://install.perlbrew.pl

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
  <head>
    <title>400 Bad Request</title>
  </head>
  <body>
    <h1>Bad Request</h1>
    <p>Your browser sent a request that this server could not understand.<br />
    </p>
  </body>
</html>

这是我的 Curl 版本: curl -V

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 协议:tftp ftp telnet dict ldap ldaps http 文件 https ftps scp sftp

功能:GSS 协商 IDN IPv6 大文件 NTLM SSL 库

通常的编译器也安装了yum groupinstall 'Development Tools'

什么会失败?真是奇怪……

【问题讨论】:

  • 再试一次,它现在可以工作了。祝你好运。
  • 这里不工作。也许我的新 Centos 缺少某些东西,或者不需要某些东西。该消息包括“您的浏览器发送了此服务器无法理解的请求”。所以 Curl(或 Bash)发送错误。

标签: linux bash curl perlbrew


【解决方案1】:

http://install.perlbrew.pl 链接实际上指向https://raw.githubusercontent.com/gugod/App-perlbrew/master/perlbrew-install,这是一个 bash 脚本。我相信这个脚本中的 curl 命令是有问题的。

试试这个:将 perlbrew-install bash 脚本保存到你的机器上编辑 curl 行:

PERLBREWDOWNLOAD="curl -f -sS -Lo $LOCALINSTALLER $PERLBREWURL"

通过添加 -k 选项来禁用证书验证(参见 curl insecure option)。注释掉周围的 if/else 语句,然后从命令行运行脚本。

或者,您可以尝试安装 wget 并从 perlbrew.pl 站点执行建议的命令:

wget -O - http://install.perlbrew.pl | bash

【讨论】:

  • 太好了,它可以使用不安全的选项。伟大的。但我不完全了解问题出在我的服务器上还是在目标服务器上。也许是因为我有一个自签名证书?
  • 我最近也在 Oracle Linux 6.5(curl 版本 7.19.7)上遇到了这个问题。在 curl 版本 7.22.0 中,从 Ubuntu 主机发出相同的请求成功。所以,相信这是一个卷曲问题。不幸的是,7.19.7 目前是 Oracle Linux 6.5 的最新版本
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-08-31
  • 1970-01-01
  • 1970-01-01
  • 2023-03-22
  • 1970-01-01
  • 2019-09-26
  • 2021-10-28
相关资源
最近更新 更多