Bug: header value returned in two parts if http header is submitted to llhttp_execute in two chunks
samofoz opened this issue · 2 comments
HTTP header (count 124):
GET / HTTP/1.1
Host: localhost
User-Agent: Wget/1.21.2
Accept: /
Accept-Encoding: identity
Connection: Keep-Alive
Input:
llhttp_execute(&parser, buf, 24);
llhttp_execute(&parser, buf+24, 100);
Output:
http_on_header_field: Host
http_on_header_value: lo
http_on_header_value: calhost
http_on_header_field: User-Agent
http_on_header_value: Wget/1.21.2
http_on_header_field: Accept
http_on_header_value: /
http_on_header_field: Accept-Encoding
http_on_header_value: identity
http_on_header_field: Connection
http_on_header_value: Keep-Alive
Thanks.
Same behavior for on_header_field
, though on_header_field_complete
and on_header_value_complete
are called correctly.
This is expected.
llhttp is not stateful in regards of the input buffer and it never copies the data for further reuse. Since on_header_value_complete
is not invoked upon the first call you can use the length of http_on_header_value
to see how many characters to prepend to the next iteration.