mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-09-02 15:02:51 +08:00
scan_header() found Content-Type and Cookie with is_word(), which compares bytes exactly and requires a separator after the pattern. Field names are case-insensitive (RFC 7230 section 3.2), and the whitespace after the colon is optional, so "content-type: multipart/..." and "Content-Type:multipart/..." were both treated as absent. The value pointers were then fixed offsets that assumed exactly one space. Add header_value(), which matches a lower-case name anchored at the line start, folds the request bytes to lower case as it compares, and returns the start of the value past any blanks, so a call site no longer adds the name length by hand. Cookie scanning reuses the returned pointer, and the end-of-header test becomes the strstart() the file already has.