我可以做任何问题没有任何问题:
curl -u "username:password" http://www.example.com/exportfile.xml
但是,如果我尝试使用相同的命令到我们的网站的https版本,它会失败
curl -u "username:password" https://www.example.com/exportfile.xml
这是错误信息的样子:
About to connect() to www.example.com port 443 (#0) Trying "some ip"... connected Connected to www.example.com (some ip) port 443 (#0) Initializing NSS with certpath: sql:/etc/pki/nssdb CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none NSS error -5938 Closing connection #0 SSL connect error curl: (35) SSL connect error
所有的帮助表示赞赏
尝试使用-k/--insecure参数。
从手册页:
(SSL)此选项明确允许curl执行“不安全的”SSL连接和传输。 所有的SSL连接都将通过使用默认安装的CA证书包来保证安全。 这使得所有认为“不安全”的连接都会失败,除非使用
-k, --insecure。
$ curl -sku "username:password" "https://www.example.com/exportfile.xml"
我总是更喜欢使用-s/--silent参数,除非我正在下载某些内容并希望查看统计信息。
另请注意,在使用-v参数时,使用-s参数不会阻止详细输出。