As per RFC 7230, section 3.5, the recipient MAY recognize a single LF as a line terminator and ignore any preceding CR for the start-line and header fields.
This feature is optional by HTTP specification, but it simplifies the scanning algorithm. Now we need to check for single character instead of two.
Also fix buffer overflow, which happens when data length is 0 (empty packet). This can be verified by simply putting assert(*len != 0) in next_header() function and by executing the tests make check afterwards.
As per RFC 7230, section 3.5, the recipient MAY recognize a single LF as a line terminator and ignore any preceding CR for the start-line and header fields.
This feature is optional by HTTP specification, but it simplifies the scanning algorithm. Now we need to check for single character instead of two.
Also fix buffer overflow, which happens when data length is 0 (empty packet). This can be verified by simply putting assert(*len != 0) in next_header() function and by executing the tests
make check
afterwards.Fixes: #366