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

  • How Does Curl Fail? What Error Messages are produced? – Andrew Borg Sep 25 '15 at 17:52
  • Are you behind a proxy? – guntbert Sep 25 '15 at 17:54
  • no we are not behind a proxy – ITFun Sep 25 '15 at 17:58
  • Make sure your system is up to date. – Michael Hampton Sep 26 '15 at 21:31
  • Ensure the site supports TLS v1.0. Most installations of curl do not support TLSv1.1 or later yet. Test the site with Qualys SSL Test – Aaron Sep 27 '15 at 16:01

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.