mirror of https://github.com/fafhrd91/actix-web
Merge branch 'master' into headermap2
This commit is contained in:
commit
90bc91644f
|
@ -6,6 +6,12 @@
|
||||||
|
|
||||||
- Implement `From<&HeaderMap>` for `http::HeaderMap` and vice versa.
|
- Implement `From<&HeaderMap>` for `http::HeaderMap` and vice versa.
|
||||||
|
|
||||||
|
## 3.5.1
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Prevent hang when returning zero-sized response bodies through compression layer.
|
||||||
|
|
||||||
## 3.5.0
|
## 3.5.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "3.5.0"
|
version = "3.5.1"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-http)
|
[](https://crates.io/crates/actix-http)
|
||||||
[](https://docs.rs/actix-http/3.5.0)
|
[](https://docs.rs/actix-http/3.5.1)
|
||||||

|

|
||||||

|

|
||||||
<br />
|
<br />
|
||||||
[](https://deps.rs/crate/actix-http/3.5.0)
|
[](https://deps.rs/crate/actix-http/3.5.1)
|
||||||
[](https://crates.io/crates/actix-http)
|
[](https://crates.io/crates/actix-http)
|
||||||
[](https://discord.gg/NWpN5mmg3x)
|
[](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,21 @@ impl<B: MessageBody> Encoder<B> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn empty() -> Self {
|
||||||
|
Encoder {
|
||||||
|
body: EncoderBody::Full { body: Bytes::new() },
|
||||||
|
encoder: None,
|
||||||
|
fut: None,
|
||||||
|
eof: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn response(encoding: ContentEncoding, head: &mut ResponseHead, body: B) -> Self {
|
pub fn response(encoding: ContentEncoding, head: &mut ResponseHead, body: B) -> Self {
|
||||||
// no need to compress an empty body
|
// no need to compress empty bodies
|
||||||
if matches!(body.size(), BodySize::None | BodySize::Sized(0)) {
|
match body.size() {
|
||||||
return Self::none();
|
BodySize::None => return Self::none(),
|
||||||
|
BodySize::Sized(0) => return Self::empty(),
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let should_encode = !(head.headers().contains_key(&CONTENT_ENCODING)
|
let should_encode = !(head.headers().contains_key(&CONTENT_ENCODING)
|
||||||
|
|
Loading…
Reference in New Issue