Skip to content

v0.70.0

Latest

Choose a tag to compare

@yhirose yhirose released this 05 Dec 17:57

What's Changed

Behavior changes

  • Client: response header fields are read under a new CPPHTTPLIB_RESPONSE_HEADER_MAX_LENGTH, 32768 by default, instead of CPPHTTPLIB_HEADER_MAX_LENGTH (8192), which is meant for the request headers a server accepts. Some servers send longer fields: www.youtube.com returns a 13KB one, so every request to it failed with Error::Read.

Security-relevant fixes

  • Client (streaming): with a zero payload limit, a read from stream::* or open_stream() decompressed everything it had read into memory with no bound, so a small compressed response could exhaust the client's memory. SSEClient has read its stream with a zero limit since v0.62.0, so it was affected with default settings when built with Brotli or zstd support. A single read is now kept within CPPHTTPLIB_PAYLOAD_MAX_LENGTH, while the stream as a whole stays unbounded.

Bug fixes

  • gzip: every member of a multi-member gzip body is decoded (#2710, RFC 1952 2.2). Decoding stopped at the end of the first member, so the body came back cut short with no error.
  • Server: a ranged set_content() response to a request with Accept-Encoding is left uncompressed (#2709). It was sliced before compression, so Content-Range described the uncompressed bytes. Partial responses are now served from the identity representation, as static files already are.
  • Server: a Range header in which some ranges start past the end of the body is served from the remaining ranges instead of being answered with 416 (#2703, RFC 9110 14.1.1). 416 is still returned when no range is satisfiable.
  • Server: an If-Range date must match Last-Modified exactly (#2707, RFC 9110 13.1.5). A date later than Last-Modified used to be accepted too.
  • Client: the redirect host is compared case-insensitively (#2708), so a redirect to the same host written in a different case reuses the current client.
  • Multipart: a filename* parameter with a language tag, such as UTF-8'en'..., is accepted (#2704, RFC 8187). It used to make the whole body invalid, and the request got 400.
  • Windows: FileStat uses the 64-bit _wstat64 (#2705), so set_mount_point serves files of 2 GiB or more instead of returning 404.

Other

  • Fuzzing: added chunked_decoder_fuzzer and a seed corpus for multipart_parser_fuzzer (#2706).

Full Changelog: v0.69.0...v0.70.0