cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Re: Documentation on how to do a zero-byte POST is misleading

From: McGarvey, Kevin <kmcGarvey_at_verisign.com>
Date: Wed, 21 Nov 2007 13:33:10 -0500

> 2007/11/20, Romanus, Emil
>
> 2007/11/20, McGarvey, Kevin <kmcGarvey_at_verisign.com>:
> > but this doesn't:
> >
> > curl_rc = curl_easy_setopt(clntPtr_, CURLOPT_POSTFIELDSIZE, 0);
> > curl_rc = curl_easy_setopt(clntPtr_, CURLOPT_POSTFIELDS, NULL);
> >
>
> Very strange. Because as I remember it, that was *the*
> solution for a problem I had before the documentation was
> updated with this info. It solved my problem when doing a
> no-content post. My case involved doing multiple POST and GET
> requests in a row using the same handle, then finally a
> no-content POST request.
>
> What libcurl version do you have?
>

7.15.5-1.fc5

> >
> > Setting CURLOPT_POSTFIELDS to NULL causes the subsequent
> post request
> > to block
> >
>
> That's the exact issue I had, we solved it here on the
> mailing list and Daniel added the notice in the
> documentation. The solution, which worked for me, was to set
> CURLOPT_POSTFIELDSIZE to 0.

That is part of the solution that worked for us, but we also had to set
CURLOPT_POSTFIELDS to a valid char pointer. We did this by passing "".
Passing NULL or omitting the line that sets CURLOPT_POSTFIELDS (which it
seems you should be able to do if you set CURLOPT_POSTFIELDSIZE to 0)
caused it to block.

Regards,

Kevin McGarvey
>
> Regards,
> Emil Romanus
Received on 2007-11-21