![连接 https Web 应用程序时出现 cURL 段错误,但 wget 可以连接](https://linux22.com/image/1527601/%E8%BF%9E%E6%8E%A5%20https%20Web%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E6%97%B6%E5%87%BA%E7%8E%B0%20cURL%20%E6%AE%B5%E9%94%99%E8%AF%AF%EF%BC%8C%E4%BD%86%20wget%20%E5%8F%AF%E4%BB%A5%E8%BF%9E%E6%8E%A5.png)
我已经使用 Jetty 和 SSL 设置了服务器。我对客户端和服务器使用自签名服务器证书。当我尝试使用 wget 访问它时,一切都正常。当我尝试使用 curl 访问它时,问题出现了:
$ curl -k --cert ./mycert-001.pem --key ./mykey-001.pem https://****:9994/rest/list --verbose
* About to connect() to server port 9994 (#0)
* Trying ****...
* Connected to server(****) port 9994 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* NSS: client certificate from file
* subject: CN=foo,OU=bar,O=baz,L=Default City,C=US
* start date: Nov 29 18:50:58 2016 GMT
* expire date: Nov 29 18:50:58 2019 GMT
* common name: foo
* issuer: CN=foo,OU=bar,O=baz,L=Default City,C=US
Segmentation fault
然后当我尝试使用 wget 时:
$ wget --certificate=mycert-001.pem --private-key=mykey-001.pem --no-check-certificate --auth-no-challenge https://****:9994/rest/list
--2017-04-14 15:50:20-- https://****:9994/rest/list
Resolving **** (****)... *****
Connecting to ***** (****)|****|:9994... connected.
WARNING: cannot verify ****'s certificate, issued by ‘/C=US/ST=FOO/L=Default/O=FOO/OU=FOO/CN=FOO’:
Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: ‘list.5’
[ <=> ] 58 --.-K/s in 0s
2017-04-14 15:50:20 (3.47 MB/s) - ‘list.5’ saved [58]
我是否缺少 curl 上的一个选项来让它工作?