mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-18 19:40:57 +00:00
* drop a passed-through Content-Length when the client reframes the body send_with_content_provider_and_receiver() kept a Content-Length the caller passed through after the library reframed the body: it compresses a buffered body under set_compress(true), or streams a provider without a length as chunked. prepare_default_headers() only adds a Content-Length when none is present, so the stale value went out describing the original body. With compression the server reads only that many bytes of the longer gzip stream and the rest desyncs the next request on a kept-alive connection; with a chunked provider the client emits both Content-Length and Transfer-Encoding. Erase it once the library owns the framing so write_request() emits the matching length, or none for a chunked body. A plain, uncompressed body keeps the caller's value. * Document the dropped Content-Length and tidy the new tests Note in the README that a per-request Content-Length is dropped when the library compresses or chunks the body; a default header is not. Shorten the comments, use HOST like the neighbouring tests, and start the chunked test's Content-Length count at a value the handler has to overwrite. --------- Co-authored-by: yhirose <yuji.hirose.bug@gmail.com>