Skip to content

Commit c61b685

Browse files
committed
Fixed bug in the s_header_value state
If the buffer ended with the '\r' char on the s_header_value state, the parser triggered the on_header_value() callback twice (buffer="data\r"): 1st time with "data" and 2nd time "data\r" resulting in "datadata\r" instead of "data".
1 parent d294bfd commit c61b685

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: multipart_parser.c

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len
199199
if (c == CR) {
200200
EMIT_DATA_CB(header_value, buf + mark, i - mark);
201201
p->state = s_header_value_almost_done;
202+
break;
202203
}
203204
if (is_last)
204205
EMIT_DATA_CB(header_value, buf + mark, (i - mark) + 1);

0 commit comments

Comments
 (0)