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

Commit c70bd21

Browse files
committed
Change the check for 1xx status code
"status_code >= 100 && status_code < 200" might be faster than "status_code / 100 == 1"
1 parent 4b6da4f commit c70bd21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

http_parser.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,11 @@ size_t http_parser_execute (http_parser *parser,
886886
case s_res_status_start:
887887
{
888888
/* See RFC 7230 section 3.3.3, step 1 */
889-
if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
889+
if ((parser->status_code >= 100 &&
890+
parser->status_code < 200) || /* 1xx e.g. Continue */
890891
parser->status_code == 204 || /* No Content */
891892
parser->status_code == 304) { /* Not Modified */
892-
parser->flags |= F_SKIPBODY;
893+
parser->flags |= F_SKIPBODY;
893894
}
894895
MARK(status);
895896
UPDATE_STATE(s_res_status);

0 commit comments

Comments
 (0)