cURL / Mailing Lists / curl-library / Single Mail

curl-library

Cannot PUT to a collection - webdav problem

From: Felix Hammer <f.hammer_at_gmx.de>
Date: Wed, 25 Feb 2009 22:17:47 +0100

Hi

I tried to upload a file to apache2/webdav server via libcurl. Therefore i
took the http-put.c example.

When i do: ./httpputexample myFile http://myserver/webdav/ i always get:

* About to connect() to myserver port 80 (#0)
* Trying myserver... * connected
* Connected to myserver (myserver) port 80 (#0)
> PUT /webdav/ HTTP/1.1
Host: myserver
Accept: */*
Content-Length: 12470
Expect: 100-continue

< HTTP/1.1 100 Continue
*** We read 12470 bytes from file
*** We read 0 bytes from file
< HTTP/1.1 409 Conflict
< Date: Wed, 25 Feb 2009 21:12:20 GMT
< Server: Apache/2.2.3 (Debian) DAV/2
< Content-Length: 260
< Content-Type: text/html; charset=ISO-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>409 Conflict</title>
</head><body>
<h1>Conflict</h1>
<p>Cannot PUT to a collection.</p>
<hr />
<address>Apache/2.2.3 (Debian) DAV/2 Server at myserver Port 80</address>
</body></html>
* Connection #0 to host myserver left intact
* Closing connection #0

When i use the command line curl with the same file and same server like:
"curl -T myfile http://myserver/webdav/" everything works fine:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /webdav/Lehrerarbeitstage.odt has been created.</p>
<hr />
<address>Apache/2.2.3 (Debian) DAV/2 Server at myserver Port 80</address>
</body></html>

Does anybody know what i'am doing wrong with the example?

best regards
Felix
Received on 2009-02-25