Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Change the check for 1xx status code
Browse files Browse the repository at this point in the history
"status_code >= 100 && status_code < 200" might be faster than
"status_code / 100 == 1"
  • Loading branch information
azaretsky committed May 4, 2019
1 parent 4b6da4f commit c70bd21
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,11 @@ size_t http_parser_execute (http_parser *parser,
case s_res_status_start:
{
/* See RFC 7230 section 3.3.3, step 1 */
if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
if ((parser->status_code >= 100 &&
parser->status_code < 200) || /* 1xx e.g. Continue */
parser->status_code == 204 || /* No Content */
parser->status_code == 304) { /* Not Modified */
parser->flags |= F_SKIPBODY;
parser->flags |= F_SKIPBODY;
}
MARK(status);
UPDATE_STATE(s_res_status);
Expand Down

0 comments on commit c70bd21

Please sign in to comment.