This repository was archived by the owner on Nov 6, 2022. It is now read-only.
This repository was archived by the owner on Nov 6, 2022. It is now read-only.
HEAD, 1xx, 204, 304 have content-length but do not have body #251
Open
Description
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:
if (settings->on_headers_complete) {
switch (settings->on_headers_complete(parser)) {
case 0:
if (status_code / 100 == 1 || status_code == 204 || status_code == 304)
parser->flags |= F_SKIPBODY;
break;
Metadata
Metadata
Assignees
Labels
No labels