mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-19 16:45:03 +00:00
RFC 9110 Section 7.6.1 defines Connection as a comma-separated list of case-insensitive connection options, and Section 5.3 lets that list be split across several field lines. Comparing the whole field value against a single option gets both wrong. A client sending "Connection: keep-alive, close" was answered without a Connection header and its socket was kept open, so the close it asked for was never performed and never announced. An HTTP/1.0 client asking for keep-alive only got it by spelling the option exactly "Keep-Alive"; the lowercase form everyone actually sends closed the connection instead. Route the five Connection checks through has_header_token(), which already walks every field line and compares complete tokens. Expect is left alone: matching "100-continue" as a token would make an unrecognized expectation alongside it look acceptable, where Section 10.1.1 asks for 417.