curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Server Sent Events and gzip

From: Daniel Stenberg via curl-library <>
Date: Tue, 28 Nov 2023 14:08:28 +0100 (CET)

On Tue, 28 Nov 2023, Stefan Lauer via curl-library wrote:

> When I use the curl command line interface with:
> curl -v --compressed -i „[URL]" -H "accept: text/event-stream" -H "Accept-Encoding: gzip“

I would recommend *not* setting that custom Accept-Encoding header. The
--compressed option sets the header itself to the value it deems best, which
may or may not be exactly "gzip". As it depends on what capabilities your
libcurl has.

The same goes for when using libcurl. It is better to let it use the methods
it supports rather than overriding it with a specific method.

> curl.http_transfer_decoding(true).unwrap();

Transfer encoding is rarely used (by anyone, anywhere). I would try without it
first to see if it makes anything different.

> If I use http-Version 1.1 I get an error: Error { description: "Transferred
> a partial file", code: 18, extra: Some("transfer closed with outstanding
> read data remaining") }

I would set verbose output to figure out what's going on more exactly over the
wire. This sounds as if the transfer is somehow aborted before the entire body
has been received.

  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features

Received on 2023-11-28