why is curl to https not working

I can do the following without any problems:

curl -u "username:password" http://www.example.com/exportfile.xml

But if I try to use the same command to the https version of our site it fails

curl -u "username:password" https://www.example.com/exportfile.xml

This is what the error message looks like:

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

All help is appreciated


Try using the -k/--insecure parameter.

From man page:

(SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, --insecure is used.

$ curl -sku "username:password" "https://www.example.com/exportfile.xml"

I always prefer to use the -s/--silent parameter as well, unless I am downloading something and want to see the stats.

Also note that using the -s parameter does not prevent verbose output when using the -v parameter.