curl-rust
curl-rust copied to clipboard
curl with brotli compression
How can I use curl to fetch pages using brotli compression? when i use handle.accept_encoding("gzip,deflate,br").unwrap(); and then use perform(), it panic :
Error { description: "Unrecognized or bad HTTP Content or Transfer-Encoding", code: 61, extra: Some("Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.") }
it seems that curl did not support brotli compression
The bundled version of libcurl included in the crate is not compiled with brotli support by default. We would accept a PR to add brotli support behind an optional crate feature though!
It might be possible to use the brotli crate written in Rust here, as it supposedly is ABI-compatible with libbrotli that curl normally uses. Otherwise we could use brotlic-sys to pull in libbrotli and statically link to it.