threads / discuss / 39189

CURLOPT_NOBODY

Subject: CURLOPT_NOBODY

## tl;dr

4 messages between Apr 30, 2015 and Apr 30, 2015.

replies: 3people: 2as markdown or json

Thiago Farina· Apr 30, 2015, 02:20 UTC · lore
Hey there,

Do we need to set CURLOPT_NOBODY to 0 in https://code.googlesource.com/git/+/master/http.c#1138? Do we do this for the sake of doing, because it doesn't hurt?

According to the documentation in http://curl.haxx.se/libcurl/c/CURLOPT_HTTPGET.html, if we set HTTPGET to 1 it will automatically set NOBODY to 0, so the answer for the above question would be no.

Also, according to http://curl.haxx.se/libcurl/c/CURLOPT_NOBODY.html, it is 0 by default.

Bye,
-- 
Thiago Farina
Jeff King· Apr 30, 2015, 03:55 UTC · re: Thiago Farina · lore

Re: CURLOPT_NOBODY

On Wed, Apr 29, 2015 at 11:20:55PM -0300, Thiago Farina wrote:
Show 8 quoted lines
> Do we need to set CURLOPT_NOBODY to 0 in
> https://code.googlesource.com/git/+/master/http.c#1138? Do we do this
> for the sake of doing, because it doesn't hurt?
> 
> According to the documentation in
> http://curl.haxx.se/libcurl/c/CURLOPT_HTTPGET.html, if we set HTTPGET
> to 1 it will automatically set NOBODY to 0, so the answer for the
> above question would be no.
It may have been necessary at one time...

Running "git blame" on the curl repository's lib/url.c shows that the behavior started in 726b9e2, which is in curl 7.14.1, released in 2005.

Grepping for LIBCURL_VERSION_NUM in git, we definitely support versions older than that. Most of those version checks are quite old, too, and we could probably stop supporting antique versions of curl. But unless there is a compelling benefit (e.g., we get to clean up some old cruft), I'd rather leave things as-is.

Dropping this one line does not seem like a compelling cleanup to me, though it's possible if we said "you must have curl from the last 5 years" we could do other cleanups, and this would come along for the ride.

> Also, according to http://curl.haxx.se/libcurl/c/CURLOPT_NOBODY.html,
> it is 0 by default.

We reuse curl handles, so we reinitialize the request-specific options for each request.

-Peff
Jeff King· Apr 30, 2015, 20:13 UTC · re: Thiago Farina · lore

Re: CURLOPT_NOBODY

On Thu, Apr 30, 2015 at 04:57:28PM -0300, Thiago Farina wrote:
> The same logic you apply to CURLOPT_FILE -> CURLOPT_WRITEDATA?

Maybe. I had to track down the appropriate curl versions for the NOBODY case manually. If you'd like to do the same for CURLOPT_FILE, be my guest (and if it has always been that way, I do not mind a cleanup patch).

-Peff

← back to recent threads