mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
tweak compress feature docs
This commit is contained in:
parent
baa5a663c4
commit
73a655544e
@ -1,19 +1,17 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Change compression algorithm features flags. [#2250]
|
* Change compression algorithm features flags. [#2250]
|
||||||
|
|
||||||
[#2250]: https://github.com/actix/actix-web/pull/2250
|
[#2250]: https://github.com/actix/actix-web/pull/2250
|
||||||
|
|
||||||
|
|
||||||
## 4.0.0-beta.7 - 2021-06-17
|
## 4.0.0-beta.7 - 2021-06-17
|
||||||
### Added
|
### Added
|
||||||
* `HttpServer::worker_max_blocking_threads` for setting block thread pool. [#2200]
|
* `HttpServer::worker_max_blocking_threads` for setting block thread pool. [#2200]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Adjusted default JSON payload limit to 2MB (from 32kb) and included size and limits in the `JsonPayloadError::Overflow` error variant. [#2162]
|
* Adjusted default JSON payload limit to 2MB (from 32kb) and included size and limits in the `JsonPayloadError::Overflow` error variant. [#2162]
|
||||||
[#2162]: (https://github.com/actix/actix-web/pull/2162)
|
[#2162]: (https://github.com/actix/actix-web/pull/2162)
|
||||||
* `ServiceResponse::error_response` now uses body type of `Body`. [#2201]
|
* `ServiceResponse::error_response` now uses body type of `Body`. [#2201]
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* Streaming and pipelining
|
* Streaming and pipelining
|
||||||
* Keep-alive and slow requests handling
|
* Keep-alive and slow requests handling
|
||||||
* Client/server [WebSockets](https://actix.rs/docs/websockets/) support
|
* Client/server [WebSockets](https://actix.rs/docs/websockets/) support
|
||||||
* Transparent content compression/decompression (br, gzip, deflate)
|
* Transparent content compression/decompression (br, gzip, deflate, zstd)
|
||||||
* Powerful [request routing](https://actix.rs/docs/url-dispatch/)
|
* Powerful [request routing](https://actix.rs/docs/url-dispatch/)
|
||||||
* Multipart streams
|
* Multipart streams
|
||||||
* Static assets
|
* Static assets
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Change compression algorithm features flags. [#2250]
|
* Change compression algorithm features flags. [#2250]
|
||||||
|
|
||||||
[#2250]: https://github.com/actix/actix-web/pull/2250
|
[#2250]: https://github.com/actix/actix-web/pull/2250
|
||||||
|
|
||||||
|
|
||||||
## 3.0.0-beta.7 - 2021-06-17
|
## 3.0.0-beta.7 - 2021-06-17
|
||||||
### Added
|
### Added
|
||||||
* Alias `body::Body` as `body::AnyBody`. [#2215]
|
* Alias `body::Body` as `body::AnyBody`. [#2215]
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Change compression algorithm features flags. [#2250]
|
* Change compression algorithm features flags. [#2250]
|
||||||
|
|
||||||
[#2250]: https://github.com/actix/actix-web/pull/2250
|
[#2250]: https://github.com/actix/actix-web/pull/2250
|
||||||
|
|
||||||
|
|
||||||
## 3.0.0-beta.6 - 2021-06-17
|
## 3.0.0-beta.6 - 2021-06-17
|
||||||
* No significant changes since 3.0.0-beta.5.
|
* No significant changes since 3.0.0-beta.5.
|
||||||
|
|
||||||
|
|
||||||
## 3.0.0-beta.5 - 2021-04-17
|
## 3.0.0-beta.5 - 2021-04-17
|
||||||
### Removed
|
### Removed
|
||||||
* Deprecated methods on `ClientRequest`: `if_true`, `if_some`. [#2148]
|
* Deprecated methods on `ClientRequest`: `if_true`, `if_some`. [#2148]
|
||||||
|
@ -2,17 +2,19 @@ use std::error::Error as StdError;
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> Result<(), Box<dyn StdError>> {
|
async fn main() -> Result<(), Box<dyn StdError>> {
|
||||||
std::env::set_var("RUST_LOG", "actix_http=trace");
|
std::env::set_var("RUST_LOG", "client=trace,awc=trace,actix_http=trace");
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let client = awc::Client::new();
|
let client = awc::Client::new();
|
||||||
|
|
||||||
// Create request builder, configure request and send
|
// Create request builder, configure request and send
|
||||||
let mut response = client
|
let request = client
|
||||||
.get("https://www.rust-lang.org/")
|
.get("https://www.rust-lang.org/")
|
||||||
.append_header(("User-Agent", "Actix-web"))
|
.append_header(("User-Agent", "Actix-web"));
|
||||||
.send()
|
|
||||||
.await?;
|
println!("Request: {:?}", request);
|
||||||
|
|
||||||
|
let mut response = request.send().await?;
|
||||||
|
|
||||||
// server http response
|
// server http response
|
||||||
println!("Response: {:?}", response);
|
println!("Response: {:?}", response);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//! `awc` is a HTTP and WebSocket client library built on the Actix ecosystem.
|
//! `awc` is a HTTP and WebSocket client library built on the Actix ecosystem.
|
||||||
//!
|
//!
|
||||||
//! ## Making a GET request
|
//! # Making a GET request
|
||||||
//!
|
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # #[actix_rt::main]
|
//! # #[actix_rt::main]
|
||||||
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
||||||
@ -16,10 +15,8 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## Making POST requests
|
//! # Making POST requests
|
||||||
//!
|
//! ## Raw body contents
|
||||||
//! ### Raw body contents
|
|
||||||
//!
|
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # #[actix_rt::main]
|
//! # #[actix_rt::main]
|
||||||
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
||||||
@ -31,8 +28,7 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ### Forms
|
//! ## Forms
|
||||||
//!
|
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # #[actix_rt::main]
|
//! # #[actix_rt::main]
|
||||||
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
||||||
@ -46,8 +42,7 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ### JSON
|
//! ## JSON
|
||||||
//!
|
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # #[actix_rt::main]
|
//! # #[actix_rt::main]
|
||||||
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
//! # async fn main() -> Result<(), awc::error::SendRequestError> {
|
||||||
@ -64,8 +59,24 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## WebSocket support
|
//! # Response Compression
|
||||||
|
//! All [official][iana-encodings] and common content encoding codecs are supported, optionally.
|
||||||
//!
|
//!
|
||||||
|
//! The `Accept-Encoding` header will automatically be populated with enabled codecs and added to
|
||||||
|
//! outgoing requests, allowing servers to select their `Content-Encoding` accordingly.
|
||||||
|
//!
|
||||||
|
//! Feature flags enable these codecs according to the table below. By default, all `compress-*`
|
||||||
|
//! features are enabled.
|
||||||
|
//!
|
||||||
|
//! | Feature | Codecs |
|
||||||
|
//! | ----------------- | ------------- |
|
||||||
|
//! | `compress-brotli` | brotli |
|
||||||
|
//! | `compress-gzip` | gzip, deflate |
|
||||||
|
//! | `compress-zstd` | zstd |
|
||||||
|
//!
|
||||||
|
//! [iana-encodings]: https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding
|
||||||
|
//!
|
||||||
|
//! # WebSocket support
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # #[actix_rt::main]
|
//! # #[actix_rt::main]
|
||||||
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@ -128,6 +139,9 @@ pub use self::sender::SendClientRequest;
|
|||||||
|
|
||||||
/// An asynchronous HTTP and WebSocket client.
|
/// An asynchronous HTTP and WebSocket client.
|
||||||
///
|
///
|
||||||
|
/// You should take care to create, at most, one `Client` per thread. Otherwise, expect higher CPU
|
||||||
|
/// and memory usage.
|
||||||
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
/// use awc::Client;
|
/// use awc::Client;
|
||||||
@ -136,10 +150,10 @@ pub use self::sender::SendClientRequest;
|
|||||||
/// async fn main() {
|
/// async fn main() {
|
||||||
/// let mut client = Client::default();
|
/// let mut client = Client::default();
|
||||||
///
|
///
|
||||||
/// let res = client.get("http://www.rust-lang.org") // <- Create request builder
|
/// let res = client.get("http://www.rust-lang.org")
|
||||||
/// .insert_header(("User-Agent", "Actix-web"))
|
/// .insert_header(("User-Agent", "my-app/1.2"))
|
||||||
/// .send() // <- Send HTTP request
|
/// .send()
|
||||||
/// .await; // <- send request and wait for response
|
/// .await;
|
||||||
///
|
///
|
||||||
/// println!("Response: {:?}", res);
|
/// println!("Response: {:?}", res);
|
||||||
/// }
|
/// }
|
||||||
|
@ -57,8 +57,10 @@
|
|||||||
//! * Runs on stable Rust 1.46+
|
//! * Runs on stable Rust 1.46+
|
||||||
//!
|
//!
|
||||||
//! # Crate Features
|
//! # Crate Features
|
||||||
//! * `compress` - content encoding compression support (enabled by default)
|
|
||||||
//! * `cookies` - cookies support (enabled by default)
|
//! * `cookies` - cookies support (enabled by default)
|
||||||
|
//! * `compress-brotli` - brotli content encoding compression support (enabled by default)
|
||||||
|
//! * `compress-gzip` - gzip and deflate content encoding compression support (enabled by default)
|
||||||
|
//! * `compress-zstd` - zstd content encoding compression support (enabled by default)
|
||||||
//! * `openssl` - HTTPS support via `openssl` crate, supports `HTTP/2`
|
//! * `openssl` - HTTPS support via `openssl` crate, supports `HTTP/2`
|
||||||
//! * `rustls` - HTTPS support via `rustls` crate, supports `HTTP/2`
|
//! * `rustls` - HTTPS support via `rustls` crate, supports `HTTP/2`
|
||||||
//! * `secure-cookies` - secure cookies support
|
//! * `secure-cookies` - secure cookies support
|
||||||
|
Loading…
Reference in New Issue
Block a user