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.
Server Sent Events and gzip
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Stefan Lauer via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 28 Nov 2023 13:05:29 +0100
Hello,
I have a webserver wich sent Server Sent Events with an encoding gzip.
When I use the curl command line interface with:
curl -v --compressed -i „[URL]" -H "accept: text/event-stream" -H "Accept-Encoding: gzip“
I get the header:
< HTTP/2 200
< content-type: text/event-stream
< cache-control: no-cache
< vary: accept-encoding
< content-encoding: gzip
< strict-transport-security: max-age=15724800; includeSubDomains
and I can see my decoded events in the terminal. Everything is working as expected.
When I do it with libcurl via curl-rust I get an error.
The header:
< HTTP/2 200
< content-type: text/event-stream
< content-encoding: gzip
< vary: accept-encoding
< cache-control: no-cache
< strict-transport-security: max-age=15724800; includeSubDomains
The header is identical to the first.
This is the error i get:
Error { description: "Transferred a partial file", code: 18, extra: Some("HTTP/2 stream 1 was reset") }
The code:
let mut curl = Easy::new();
let mut list = List::new();
list.append("accept: text/event-stream").unwrap();
curl.http_headers(list).unwrap();
curl.verbose(true).unwrap();
curl.url(URL).unwrap();
curl.http_transfer_decoding(true).unwrap();
curl.http_content_decoding(true).unwrap();
curl.accept_encoding("gzip").unwrap();
curl.verbose(true).unwrap();
curl.write_function(|data|{
println!("{}", std::str::from_utf8(data).unwrap());
Ok(data.len())
}).unwrap();
curl.perform().unwrap();
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") }
What I am doing wrong? Is there a Bug? Please point me to the right direction.
Date: Tue, 28 Nov 2023 13:05:29 +0100
Hello,
I have a webserver wich sent Server Sent Events with an encoding gzip.
When I use the curl command line interface with:
curl -v --compressed -i „[URL]" -H "accept: text/event-stream" -H "Accept-Encoding: gzip“
I get the header:
< HTTP/2 200
< content-type: text/event-stream
< cache-control: no-cache
< vary: accept-encoding
< content-encoding: gzip
< strict-transport-security: max-age=15724800; includeSubDomains
and I can see my decoded events in the terminal. Everything is working as expected.
When I do it with libcurl via curl-rust I get an error.
The header:
< HTTP/2 200
< content-type: text/event-stream
< content-encoding: gzip
< vary: accept-encoding
< cache-control: no-cache
< strict-transport-security: max-age=15724800; includeSubDomains
The header is identical to the first.
This is the error i get:
Error { description: "Transferred a partial file", code: 18, extra: Some("HTTP/2 stream 1 was reset") }
The code:
let mut curl = Easy::new();
let mut list = List::new();
list.append("accept: text/event-stream").unwrap();
curl.http_headers(list).unwrap();
curl.verbose(true).unwrap();
curl.url(URL).unwrap();
curl.http_transfer_decoding(true).unwrap();
curl.http_content_decoding(true).unwrap();
curl.accept_encoding("gzip").unwrap();
curl.verbose(true).unwrap();
curl.write_function(|data|{
println!("{}", std::str::from_utf8(data).unwrap());
Ok(data.len())
}).unwrap();
curl.perform().unwrap();
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") }
What I am doing wrong? Is there a Bug? Please point me to the right direction.
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2023-11-28