-
Notifications
You must be signed in to change notification settings - Fork 1.5k
HEAD, 1xx, 204, 304 have content-length but do not have body #251
Comments
Now I add the check in on_headers_complete which looks like:
}; But I think the check about the 1xx, 204, 304 should move to http_parser.c. For HEAD, maybe should add a callback function will be better: int get_request_flags() { |
Hm... I think you are right. What are your thoughts on this @mscdex @tatsuhiro-t ? |
I'm doing same thing for those status codes in my projects. I prefer HEAD handling as is, since adding another callback would break compatibility, unless we leave current interface. |
Ok, I'm convinced! :) Let's do this thing. |
Did this ever happen? |
There are some comments in http_parser.cc, line 1837:
/* Here we call the headers_complete callback. This is somewhat
* different than other callbacks because if the user returns 1, we
* will interpret that as saying that this message has no body. This
* is needed for the annoying case of recieving a response to a HEAD
* request.
*
* We'd like to use CALLBACK_NOTIFY_NOADVANCE() here but we cannot, so
* we have to simulate it by handling a change in errno below.
*/
Excludes the HEAD request, the 1xx, 204, 304 response also have Content-Length but do not have HTTP body.
So maybe the following code should add:
The text was updated successfully, but these errors were encountered: