cURL / Mailing Lists / curl-library / Single Mail

curl-library

Simple HTTP PUT - response content printed to screen

From: Joe Lorenz <joe.lorenz_at_plexxi.com>
Date: Fri, 25 Jan 2013 17:37:11 -0500

I'm having this problem when using libcurl in my own (Linux) app, but I can
demonstrate the same problem using the curl tool.
If a simple HTTP file upload (presumably a 'PUT'), and the file gets created at
the destination, the response content is printed to screen:

# curl --upload-file config.txt http://xpacket/files/foo
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /files/foo has been created.</p>
<hr />
<address>Apache/2.2.3 (CentOS) Server at xpacket Port 80</address>
</body></html>
#

And if the file is already there, no content is printed (as desired and expected):

# curl --upload-file config.txt http://xpacket/files/foo
#

Similar happens if the server doesn't allow the upload and we get a different
result:

# curl --upload-file config.txt http://xbuild/files/foo
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL /files/foo.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at xbuild Port 80</address>
</body></html>
#

Again, I see this in my own app using libcurl; I'm interested in fixing libcurl.
I don't think there's anything going on with curl.

Any hint in the right direction would be helpful. I've tried poking around the
source some, but am not getting very far.

Many Thanks!

        -Joe
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-26