mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-19 08:35:02 +00:00
RFC 9110 Section 5.2 and 5.3 define the combined value of repeated field lines as their values joined by commas in the order they were received. Several call sites read only the first occurrence and then split that on commas, so whatever the later field lines carried was silently dropped: an acceptable media type or content coding, an ETag, a WebSocket subprotocol, a declared trailer name, or an address a proxy appended as its own line rather than by extending the one it received. Add detail::get_combined_header_value() and use it for Accept, Accept-Encoding, If-None-Match, Sec-WebSocket-Protocol, Trailer and X-Forwarded-For. Empty field lines are skipped so the combined value never starts with a bare comma, which parse_accept_header() rejects outright. Also drop the now-dead manual trimming in parse_trailers() and replace the istringstream-based subprotocol tokenizer with detail::split(); split() already trims each token and skips empty ones.