mirror of
https://github.com/actix/actix-web.git
synced 2024-05-20 01:08:10 +00:00
Compare commits
6 commits
4d1c1f954f
...
b97de17f5f
Author | SHA1 | Date | |
---|---|---|---|
b97de17f5f | |||
ba7fd048b6 | |||
d98938b125 | |||
5a5486b484 | |||
76b2b2734b | |||
296d546ca4 |
6
.github/workflows/ci-post-merge.yml
vendored
6
.github/workflows/ci-post-merge.yml
vendored
|
@ -45,7 +45,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install cargo-hack and cargo-ci-cache-clean
|
- name: Install cargo-hack and cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.32.0
|
uses: taiki-e/install-action@v2.32.17
|
||||||
with:
|
with:
|
||||||
tool: cargo-hack,cargo-ci-cache-clean
|
tool: cargo-hack,cargo-ci-cache-clean
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ jobs:
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
||||||
|
|
||||||
- name: Install cargo-hack
|
- name: Install cargo-hack
|
||||||
uses: taiki-e/install-action@v2.32.0
|
uses: taiki-e/install-action@v2.32.17
|
||||||
with:
|
with:
|
||||||
tool: cargo-hack
|
tool: cargo-hack
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ jobs:
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
||||||
|
|
||||||
- name: Install nextest
|
- name: Install nextest
|
||||||
uses: taiki-e/install-action@v2.32.0
|
uses: taiki-e/install-action@v2.32.17
|
||||||
with:
|
with:
|
||||||
tool: nextest
|
tool: nextest
|
||||||
|
|
||||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -50,7 +50,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install cargo-hack and cargo-ci-cache-clean
|
- name: Install cargo-hack and cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.32.0
|
uses: taiki-e/install-action@v2.32.17
|
||||||
with:
|
with:
|
||||||
tool: cargo-hack,cargo-ci-cache-clean
|
tool: cargo-hack,cargo-ci-cache-clean
|
||||||
|
|
||||||
|
|
4
.github/workflows/coverage.yml
vendored
4
.github/workflows/coverage.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
components: llvm-tools-preview
|
components: llvm-tools-preview
|
||||||
|
|
||||||
- name: Install cargo-llvm-cov
|
- name: Install cargo-llvm-cov
|
||||||
uses: taiki-e/install-action@v2.32.0
|
uses: taiki-e/install-action@v2.32.17
|
||||||
with:
|
with:
|
||||||
tool: cargo-llvm-cov
|
tool: cargo-llvm-cov
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ jobs:
|
||||||
run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json
|
run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v4.1.1
|
uses: codecov/codecov-action@v4.3.0
|
||||||
with:
|
with:
|
||||||
files: codecov.json
|
files: codecov.json
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
@ -82,7 +82,7 @@ jobs:
|
||||||
toolchain: nightly-2023-08-25
|
toolchain: nightly-2023-08-25
|
||||||
|
|
||||||
- name: Install cargo-public-api
|
- name: Install cargo-public-api
|
||||||
uses: taiki-e/install-action@v2.32.0
|
uses: taiki-e/install-action@v2.32.17
|
||||||
with:
|
with:
|
||||||
tool: cargo-public-api
|
tool: cargo-public-api
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@
|
||||||
- Add `body::to_bytes_limited()` function.
|
- Add `body::to_bytes_limited()` function.
|
||||||
- Add `body::BodyLimitExceeded` error type.
|
- Add `body::BodyLimitExceeded` error type.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fix truncated body ending without error when connection closed abnormally. [#3067]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency.
|
- Minimum supported Rust version (MSRV) is now 1.68 due to transitive `time` dependency.
|
||||||
|
|
|
@ -1118,6 +1118,7 @@ where
|
||||||
let inner = inner.as_mut().project();
|
let inner = inner.as_mut().project();
|
||||||
inner.flags.insert(Flags::READ_DISCONNECT);
|
inner.flags.insert(Flags::READ_DISCONNECT);
|
||||||
if let Some(mut payload) = inner.payload.take() {
|
if let Some(mut payload) = inner.payload.take() {
|
||||||
|
payload.set_error(io::Error::from(io::ErrorKind::UnexpectedEof).into());
|
||||||
payload.feed_eof();
|
payload.feed_eof();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -439,6 +439,60 @@ async fn content_length() {
|
||||||
srv.stop().await;
|
srv.stop().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn content_length_truncated() {
|
||||||
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
|
|
||||||
|
let mut srv = test_server(|| {
|
||||||
|
HttpService::build()
|
||||||
|
.h1(|mut req: Request| async move {
|
||||||
|
let expected_length: usize = req.uri().path()[1..].parse().unwrap();
|
||||||
|
let mut payload = req.take_payload();
|
||||||
|
|
||||||
|
let mut length = 0;
|
||||||
|
let mut seen_error = false;
|
||||||
|
while let Some(chunk) = payload.next().await {
|
||||||
|
match chunk {
|
||||||
|
Ok(b) => length += b.len(),
|
||||||
|
Err(_) => {
|
||||||
|
seen_error = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if seen_error {
|
||||||
|
return Result::<_, Infallible>::Ok(Response::bad_request());
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_eq!(length, expected_length, "length must match when no error");
|
||||||
|
Result::<_, Infallible>::Ok(Response::ok())
|
||||||
|
})
|
||||||
|
.tcp()
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let addr = srv.addr();
|
||||||
|
let mut buf = [0; 12];
|
||||||
|
|
||||||
|
let mut conn = TcpStream::connect(&addr).await.unwrap();
|
||||||
|
conn.write_all(b"POST /10000 HTTP/1.1\r\nContent-Length: 10000\r\n\r\ndata_truncated")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
conn.shutdown().await.unwrap();
|
||||||
|
conn.read_exact(&mut buf).await.unwrap();
|
||||||
|
assert_eq!(&buf, b"HTTP/1.1 400");
|
||||||
|
|
||||||
|
let mut conn = TcpStream::connect(&addr).await.unwrap();
|
||||||
|
conn.write_all(b"POST /4 HTTP/1.1\r\nContent-Length: 4\r\n\r\ndata")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
conn.shutdown().await.unwrap();
|
||||||
|
conn.read_exact(&mut buf).await.unwrap();
|
||||||
|
assert_eq!(&buf, b"HTTP/1.1 200");
|
||||||
|
|
||||||
|
srv.stop().await;
|
||||||
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn h1_headers() {
|
async fn h1_headers() {
|
||||||
let data = STR.repeat(10);
|
let data = STR.repeat(10);
|
||||||
|
|
Loading…
Reference in a new issue