Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've configured on my Linux server (SLES11) with IHS Webserver with WebDAV enabled. A file upload via curl is successful using a URL like this:

$ curl --insecure --upload-file testfile.txt \
    https://<URL>.com/upload/hro/ -u hro:$HRO_WEBDAV_PASSWORD

Resulting in this output:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /upload/hro/testfile.txt has been created.</p>
<hr />
<address>IBM_HTTP_Server Server at <URL> Port 443</address>

If I try this with "localhost" instead of the URL it doesn't worked. I get a SSL Error:

$ curl --insecure --upload-file testfile.txt \
    https://localhost/upload/hro/ -u hro:$HRO_WEBDAV_PASSWORD

Resulting in this:

curl: (51) SSL peer certificate or SSH remote key was not OK

This is coherent because the certificate is signed for the url not for "localhost". But I have used the option --insecure and I've intended for this through the use of this option to ignore this failure.

Questions

  • What should I do to use localhost for curl?
  • Is there no option for this script to use the localhost URL?
share|improve this question
    
Is your webserver listening on all interfaces? netstat -anp |grep 443 to confirm. –  slm May 29 at 12:27
    
Might be worth taking a look at this SO Q&A: stackoverflow.com/questions/14192837/… –  slm May 29 at 12:58
    
yes, my webserver is listening on all interfaces $ netstat -anp |grep 443 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 :::443 :::* LISTEN - –  user68919 May 30 at 12:08
    
Can you run your curl command with the -v for verbose switch? –  slm May 30 at 12:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.