You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Since curl 7.71.0, setting and unsetting CURLOPT_NOBODY causes the request following unsetting it to hang. This behaviour was introduced in 9c845be, which sets the request method to HEAD when CURLOPT_NOBODY is set, but does not change it away from HEAD when it is unset. Notably, this comment and the behaviour it describes was removed 9c845be#diff-8fb104c402dc51bdffef05a372f32aa2L4000
/* ... but if unset there really is no perfect method that is the "opposite" of HEAD but in reality most people probably think GET then. The important thing is that we can't let it remain HEAD if the opt_no_body is set FALSE since then we'll behave wrong when getting HTTP. */
A HEAD request followed by a GET request (behaviour prior to 7.71.0). Instead, the second request is still a HEAD request, but curl waits to receive a body, causing a hang.
This does indeed change the behavior, but let me also point out that setting CURLOPT_NOBODY to 0L is not how to reset a handle back to doing a GET (precisely because the "opposite" of HEAD is not necessarily GET) and it is not documented to do that. We added CURLOPT_HTTPGET for exactly that purpose
Yeah that's the workaround I found, although it wasn't obvious. Perhaps that should be called out more clearly in the documentation for CURLOPT_NOBODY.
Unsetting CURLOPT_NOBODY with 0L when doing HTTP has no documented
action but before 7.71.0 that used to switch back to GET and with this
change (assuming the method is still set to HEAD) this behavior is
brought back.
Reported-by: causal-agent on github
Isssue: #5725
Since curl 7.71.0, setting and unsetting
CURLOPT_NOBODY
causes the request following unsetting it to hang. This behaviour was introduced in 9c845be, which sets the request method to HEAD whenCURLOPT_NOBODY
is set, but does not change it away from HEAD when it is unset. Notably, this comment and the behaviour it describes was removed 9c845be#diff-8fb104c402dc51bdffef05a372f32aa2L4000I did this
I expected the following
A HEAD request followed by a GET request (behaviour prior to 7.71.0). Instead, the second request is still a HEAD request, but curl waits to receive a body, causing a hang.
curl/libcurl version
operating system
The text was updated successfully, but these errors were encountered: