mirror of https://github.com/fafhrd91/actix-web
Compare commits
7 Commits
d9a3c15bae
...
4f6811b320
Author | SHA1 | Date |
---|---|---|
|
4f6811b320 | |
|
8996198f2c | |
|
68624ec63b | |
|
afad1db343 | |
|
1098d0deb7 | |
|
5dcad17a61 | |
|
5f1a4607e5 |
|
@ -38,6 +38,10 @@
|
|||
|
||||
- Add `error::InvalidStatusCode` re-export.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix `MessageType::set_headers` not using the correct payload decoder when Transfer-Encoding and Content-Length are absent.
|
||||
|
||||
## 3.7.0
|
||||
|
||||
### Added
|
||||
|
|
|
@ -17,7 +17,6 @@ edition.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"http2",
|
||||
"ws",
|
||||
|
@ -119,7 +118,7 @@ tokio-util = { version = "0.7", features = ["io", "codec"] }
|
|||
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
||||
|
||||
# http2
|
||||
h2 = { version = "0.3.26", optional = true }
|
||||
h2 = { version = "0.3.27", optional = true }
|
||||
|
||||
# websockets
|
||||
base64 = { version = "0.22", optional = true }
|
||||
|
|
|
@ -391,8 +391,20 @@ impl MessageType for ResponseHead {
|
|||
// switching protocol or connect
|
||||
PayloadType::Stream(PayloadDecoder::eof())
|
||||
} else {
|
||||
// for HTTP/1.0 read to eof and close connection
|
||||
if msg.version == Version::HTTP_10 {
|
||||
let body_allowed = match msg.status.as_u16() {
|
||||
100..=199 => false,
|
||||
204 => false,
|
||||
304 => false,
|
||||
_ => true,
|
||||
};
|
||||
// for HTTP/1.0 and HTTP/1.1 read to eof and close connection
|
||||
if msg.version == Version::HTTP_11 && body_allowed {
|
||||
if let Some(ConnectionType::Close) = msg.conn_type() {
|
||||
PayloadType::Payload(PayloadDecoder::eof())
|
||||
} else {
|
||||
PayloadType::None
|
||||
}
|
||||
} else if msg.version == Version::HTTP_10 {
|
||||
msg.set_connection_type(ConnectionType::Close);
|
||||
PayloadType::Payload(PayloadDecoder::eof())
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,6 @@ edition.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
all-features = true
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -14,7 +14,6 @@ license.workspace = true
|
|||
edition.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
all-features = true
|
||||
|
||||
[package.metadata.cargo_check_external_types]
|
||||
|
|
|
@ -17,7 +17,6 @@ edition.workspace = true
|
|||
rust-version.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"macros",
|
||||
"openssl",
|
||||
|
|
|
@ -16,7 +16,6 @@ license = "MIT OR Apache-2.0"
|
|||
edition = "2021"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
features = [
|
||||
"cookies",
|
||||
"openssl",
|
||||
|
@ -109,7 +108,7 @@ cfg-if = "1"
|
|||
derive_more = { version = "2", features = ["display", "error", "from"] }
|
||||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc", "sink"] }
|
||||
h2 = "0.3.26"
|
||||
h2 = "0.3.27"
|
||||
http = "0.2.7"
|
||||
itoa = "1"
|
||||
log = "0.4"
|
||||
|
|
|
@ -749,7 +749,7 @@ async fn client_unread_response() {
|
|||
|
||||
// awc does not read all bytes unless content-length is specified
|
||||
let bytes = res.body().await.unwrap();
|
||||
assert_eq!(bytes, Bytes::from_static(b""));
|
||||
assert_eq!(bytes, Bytes::from_static(b"welcome!"));
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
|
|
Loading…
Reference in New Issue