Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request with HEAD method hangs #2027

Closed
ghfindlay opened this issue Oct 27, 2017 · 1 comment
Closed

Request with HEAD method hangs #2027

ghfindlay opened this issue Oct 27, 2017 · 1 comment
Labels
HTTP not-a-curl-bug This is not a bug in curl

Comments

@ghfindlay
Copy link

When using libcURL, and setting the request method to HEAD, if the server responds with a header which gives certain indications that there may be a body, the request hangs for 5 minutes while waiting for the body before timing out.

I did this

I set the CURLOPT_NOBODY option as a workaround.

I expected the following

Because by definition a HEAD request can contain no body, it seems that the CURLOPT_NOBODY would not need to be set when using the HEAD method. The curl library should know not to expect a body, simply by setting the HEAD request method. As I read specs on using the HEAD method, it is intended to return the same header information as if a body had been requested, but simply return ONLY the header with no body.

curl/libcurl version

7.40.0 and 7.55.1

[curl -V output]

operating system

Windows Vista (32-bit), Windows 7 (64-bit), Windows 10 (64-bit)

@bagder bagder added the HTTP label Oct 27, 2017
@bagder
Copy link
Member

bagder commented Oct 27, 2017

This is documented behavior. As stated in the CURLOPT_CUSTOMREQUEST man page:

When you change the request method by setting CURLOPT_CUSTOMREQUEST to something, you don't actually change how libcurl behaves or acts in regards to the particular request method, it will only change the actual string sent in the request.

CURLOPT_NOBODY is not a work-around, it is how you send a HTTP request that won't wait around to read the body.

@bagder bagder added the not-a-curl-bug This is not a bug in curl label Oct 27, 2017
@bagder bagder closed this as completed Oct 29, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
HTTP not-a-curl-bug This is not a bug in curl
Development

No branches or pull requests

2 participants