http-parser impossible condition check
Consider this code (from http_parser.c):
/* Transfer-Encoding: chunked */
case h_matching_transfer_encoding_chunked:
parser->index++;
if (parser->index > sizeof(CHUNKED)-1
|| c != CHUNKED[parser->index]) {
h_state = h_general;
} else if (parser->index == sizeof(CHUNKED)-2) {
h_state = h_transfer_encoding_chunked;
}
break;
It seems parser->index > sizeof(CHUNKED)-1 can never be true, because if the token being checked matches, we would set h_state = h_transfer_encoding_chunked before parser->index can ever exceed sizeof(CHUNKED)-2. And if the token being checked doesn't match, then we will set h_state = h_general before parser->index can exceed sizeof(CHUNKED)-1.
I haven't actually tested this so I am not 100% sure.
Yeah, it appears to be unreachable indeed. Would you care to open a PR to fix it?
I haven't used the parser in a while so I am quite rusty, and I dont have a clone handy. It would probably do more harm than good at this point.