curl / Mailing Lists / curl-library / 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: CURLOPT_POST with no CURLOPT_POSTFIELDS

From: Jason Proctor via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 6 Mar 2020 09:16:36 -0800

On Thu, Mar 5, 2020 at 7:28 AM Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Wed, 4 Mar 2020, Jason Proctor via curl-library wrote:
>
> > The issue is that if you specify CURLOPT_POST but don't specify
> > CURLOPT_POSTFIELDS, then the library sticks in sending mode and
> > doesn't call the header or write callbacks, despite the fact that the
> > server has happily sent a response. Setting CURLOPT_POSTFIELDS to the
> > empty string results in the correct behaviour.
>
> That's not expected behavior nor does it match what existing libcurl tests
> verify that works. For example in test 1514:
>
> https://github.com/curl/curl/blob/master/tests/libtest/lib1514.c
>
> Can you provide a test code that reproduces this?
>

Looking at the test case I think the issue is that I set CURLOPT_POST
and provide neither CURLOPT_POSTFIELDS nor a read function. If the API
contract says I have to do one or the other, fair enough - but should
Curl survive if I don't?

Here's my code --

http://www.redfish.net/curl.c
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-03-06