micha/resty

resty fails silenty with self-signed certs (-k)

Closed this issue · 3 comments

I was struggling to understand why resty was silent on all commands, no error, no output.

GET /
GET /agents
POST /

etc.. just returned immediately. SO I poked with curl and forget the app was self-signed.

curl -L https://mysite.com
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

adding -k to the resty initialize call fixed everything.

THis critical error from curl should be presented to the user when initializing resty.

Instead of using -k why not use --cacert and point to your self-signed certificate??

I guess the point is one needs to know the problem (which resty is swallowing) in order to use either argument as a solution

The next major version will no longer hide curl error when hapenning. cf 4187af8
And It's gonna ship soon :)