cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl PUT not working correctly with --digest option

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 15 Apr 2010 11:28:44 +0200 (CEST)

On Tue, 13 Apr 2010, manuel aldana wrote:

> I am having problems with (great) curl tool. The PUT method does not work
> with the --digest option.

There is some problem involved with it, yes. See
http://curl.haxx.se/bug/view.cgi?id=2956968 for some further details.

> === curl-command
> curl -X PUT -d @payload.xml http://localhost:8080/api/ads/712566 -H
> "Content-Type: application/xml"

This is not a "normal" PUT though - this is a POST with a PUT keyword. You do
a "normal" PUT with:

  curl -T payload.xml http://localhost:8080/api/ads/712566

> Compare the Content-Length entry (2928K vs 0K).

That's not the problem itself though. libcurl just happens to send the first
POST as a zero byte post when it _knows_ it won't succeed and expects a digest
challenge back.

The problem with this approach is that many servers don't really like it.

You can try to use --anyauth instead of --digest to see what curl does then,
as it then will probe for auth quite differently.

> Seeing this I guess that --digest doesn't go well with the PUT option. It
> works fine for POST.

Since curl itself does more or less the exact same thing for POST and PUT, it
perhaps indiciates that the server is treating POST and PUT a bit differently?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-15