cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Https upload with curl

From: <kanakamahesh.anasuri_at_wipro.com>
Date: Thu, 27 Apr 2006 19:55:23 +0530

Chris:


Thank you for the information.


I am trying to use certificates instead of cookies. So I am figuring it
out required options. I am really thankful, if you have any details.


I am briefing by test setup as below.


I have created certificates (PEM format) for client and server using
openSSL. I am using Apache server/Linux platform and started server with
"server certificate". I configured server to listen HTTPS service at
port 443.


With in /apache server, I have the following directories:


/bin /build /cgi-bin /conf /error /htdocs /icons /include /lib
/logs /man /manual /modules


I downloaded file correctly from /apache/htdocs/basic/download.txt from
the curl as


$curl --cacert cacert.pem https://10.201.114.32:443/basic/download.txt
<https://10.201.114.32/basic/download.txt>


I am trying to put /home/mahesh/upload.txt in to the server using curl
as,


$curl --cacert cacert.pem -F file=@/home/mahesh/upload.txt
https://10.201.114.32:443/basic/ <https://10.201.114.32/basic/>


But it is failing; please suggest what options to use.


Thanks in advance

Mahesh



P.S: Some of my test results are as follows, which do not perform actual
PUT operation.


1.

curl --cacert cacert.pem -F file=@/home/hai.txt
https://10.201.114.32:443/ <https://10.201.114.32/>

Result: <html><body><h1>It works!</h1></body></html>


2. curl --cacert cacert.pem -F file=@/home/hai.txt
https://10.201.114.32:443/basic/

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>404 Not Found</title>

</head><body>

<h1>Not Found</h1>

<p>The requested URL /basic/ was not found on this server.</p>

</body></html>


3. curl --cacert cacert.pem -F file=@/home/hai.txt
https://10.201.114.32:443/ems_to_ne

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>301 Moved Permanently</title>

</head><body>

<h1>Moved Permanently</h1>

<p>The document has moved <a
href="https://10.201.114.32/ems_to_ne/">here</a>.</p>

</body></html>






-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Chris Dawson
Sent: Tuesday, April 25, 2006 3:17 AM
To: the curl tool
Cc: Padmarao Rajolu (WT01 - Broadband Networks)
Subject: Re: Https upload with curl


This is an example I use to make a POST of a file. I store

authentication in a cookie before I make the request, and then reuse

that cookie when I make the POST. The -H switch tells the client to

ignore a broken part of the SSL connection. The -F switches indicate

the fields in the form and their accompanying values. If you use a

value with @ at the beginning, curl sends the file referenced by that

path.


curl -b /tmp/1145820726.piab-cookies.tmp -c

/tmp/1145820726.piab-cookies.tmp -H Expect: -k -F episode[title]="Some

title -F episode[description]="Some description" -F

episode_mp3_file=@/foobar/items/1145820666.mp3

https://foobar.com/episode/create


Maybe that helps.


Chris



On 4/24/06, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 24 Apr 2006, kanakamahesh.anasuri_at_wipro.com wrote:

>

> > I am trying to setup download/upload files in to https server (using
Apache

> > server 2.0 versions)

>

> Upload how? Using what request?

>

> > $ curl --cacert cacert.pem --upload-file sample2.txt

> > https://10.201.114.32:443/basic/

>

> This makes a PUT...

>

> > <title>405 Method Not Allowed</title>

>

> ... which the server doesn't allow to that URL.

>

> --

> Commercial curl and libcurl Technical Support:
http://haxx.se/curl.html

>


The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com
Received on 2006-04-27