cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How can I append a slash to the URL of a PUT command?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 19 May 2013 10:30:06 +0200 (CEST)

On Mon, 13 May 2013, Josh Mahoney wrote:

> I'm doing the following cURL command:
> curl -i -b cookie.txt -X PUT -T "somefile.txt" http://myserver/api/upload/
>
> However, I need the url to have a trailing slash, but the result is "
> http://myserver/api/upload/somefile.txt". Is there a way to get a slash
> appended at the end?

When doing a HTTP PUT, you're supposed to identify the resource you're about
to create with the request. I would claim an API that requires it to have a
trailing slash is a bit on the broken side.

But no, curl cannot send a PUT to such a URL in any easy way I can think of.
libcurl itself can of course though, so a simple fix is probably to write a
simple program in a language with a libcurl binding.

-- 
  / 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 2013-05-19