diff --git a/include/haproxy/h1.h b/include/haproxy/h1.h index 9283df63e4d5..7152c6ed82e7 100644 --- a/include/haproxy/h1.h +++ b/include/haproxy/h1.h @@ -303,14 +303,12 @@ static inline int h1_parse_chunk_size(const struct buffer *buf, int start, int s * for the end of chunk size. */ while (1) { - if (likely(HTTP_IS_CRLF(*ptr))) { - /* we now have a CR or an LF at ptr */ - if (likely(*ptr == '\r')) { - if (++ptr >= end) - ptr = b_orig(buf); - if (--stop == 0) - return 0; - } + if (likely(*ptr == '\r')) { + /* we now have a CR, it must be followed by a LF */ + if (++ptr >= end) + ptr = b_orig(buf); + if (--stop == 0) + return 0; if (*ptr != '\n') goto error; diff --git a/src/h1_htx.c b/src/h1_htx.c index b8c6ccb05679..aed1714affa7 100644 --- a/src/h1_htx.c +++ b/src/h1_htx.c @@ -693,11 +693,6 @@ static size_t h1_parse_full_contig_chunks(struct h1m *h1m, struct htx **dsthtx, ++ridx; break; } - else if (end[ridx] == '\n') { - /* Parse LF only, nothing more to do */ - ++ridx; - break; - } else if (likely(end[ridx] == ';')) { /* chunk extension, ends at next CRLF */ if (!++ridx) @@ -710,7 +705,7 @@ static size_t h1_parse_full_contig_chunks(struct h1m *h1m, struct htx **dsthtx, continue; } else { - /* all other characters are unexpected */ + /* all other characters are unexpected, especially LF alone */ goto parsing_error; } }