curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Method PUT without file

From: Ray Satiro via curl-users <curl-users_at_cool.haxx.se>
Date: Wed, 10 Jul 2019 23:21:58 -0400

On 7/9/2019 12:20 PM, Aleksandar Lazic via curl-users wrote:
> ome REST server does not requiere a content when the PUT method is used. The
> curl tool expect a file when `-T` https://curl.haxx.se/docs/manpage.html#-T is
> used for PUT.
> There are several examples out there where the `-X PUT` is used instead of `-T`.
> Is there a easy workaround to use the native PUT flow in the curl-tool without
> to add a file?
>
> I have tried /dev/null, this works, but is it a "valid" solution from curl point
> of view?
>
> curl -vkT /dev/null https://www.domain.com/aaaaaaaa -o /dev/null
>
> ```
> * Connected to www.domain.com (IP) port 443 (#0)
> * found 148 certificates in /etc/ssl/certs/ca-certificates.crt
> * found 599 certificates in /etc/ssl/certs
> * ALPN, offering http/1.1
> * SSL connection using TLS1.2 / ECDHE_RSA_AES_256_CBC_SHA384
>
> ...
> * ALPN, server accepted to use http/1.1
>> PUT /aaaaaaaa HTTP/1.1
>> Host: www.domain.com
>> User-Agent: curl/7.47.0
>> Accept: */*
>> Transfer-Encoding: chunked
>> Expect: 100-continue
>>
> < HTTP/1.1 100 Continue

Yes that's fine.

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-07-11