mirror of https://github.com/fafhrd91/actix-web
Compare commits
11 Commits
http-v3.10
...
master
Author | SHA1 | Date |
---|---|---|
|
90c19a835d | |
|
adf57d2b24 | |
|
fcd10fbb5e | |
|
95b6a81f43 | |
|
ab18efe0ac | |
|
cede0c6dbb | |
|
1005b6a12a | |
|
d898e8f739 | |
|
353873fc04 | |
|
1390e29705 | |
|
c6e7ebd185 |
|
@ -0,0 +1,3 @@
|
||||||
|
version: "0.2"
|
||||||
|
words:
|
||||||
|
- actix
|
|
@ -49,7 +49,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.49.17
|
uses: taiki-e/install-action@v2.49.33
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ jobs:
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
|
||||||
|
|
||||||
- name: Install just, cargo-hack
|
- name: Install just, cargo-hack
|
||||||
uses: taiki-e/install-action@v2.49.17
|
uses: taiki-e/install-action@v2.49.33
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack
|
tool: just,cargo-hack
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ jobs:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.49.17
|
uses: taiki-e/install-action@v2.49.33
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ jobs:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@v2.49.17
|
uses: taiki-e/install-action@v2.49.33
|
||||||
with:
|
with:
|
||||||
tool: just
|
tool: just
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
components: llvm-tools
|
components: llvm-tools
|
||||||
|
|
||||||
- name: Install just, cargo-llvm-cov, cargo-nextest
|
- name: Install just, cargo-llvm-cov, cargo-nextest
|
||||||
uses: taiki-e/install-action@v2.49.17
|
uses: taiki-e/install-action@v2.49.33
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-llvm-cov,cargo-nextest
|
tool: just,cargo-llvm-cov,cargo-nextest
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ jobs:
|
||||||
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
||||||
|
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@v2.49.17
|
uses: taiki-e/install-action@v2.49.33
|
||||||
with:
|
with:
|
||||||
tool: just
|
tool: just
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
Cargo.lock
|
|
||||||
target/
|
target/
|
||||||
guide/build/
|
guide/build/
|
||||||
/gh-pages
|
/gh-pages
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,8 +18,8 @@ all-features = true
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bytesize = "2"
|
||||||
darling = "0.20"
|
darling = "0.20"
|
||||||
parse-size = "1"
|
|
||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
quote = "1"
|
quote = "1"
|
||||||
syn = "2"
|
syn = "2"
|
||||||
|
@ -27,7 +27,7 @@ syn = "2"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-multipart = "0.7"
|
actix-multipart = "0.7"
|
||||||
actix-web = "4"
|
actix-web = "4"
|
||||||
rustversion = "1"
|
rustversion-msrv = "0.100"
|
||||||
trybuild = "1"
|
trybuild = "1"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use bytesize::ByteSize;
|
||||||
use darling::{FromDeriveInput, FromField, FromMeta};
|
use darling::{FromDeriveInput, FromField, FromMeta};
|
||||||
use parse_size::parse_size;
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use proc_macro2::Ident;
|
use proc_macro2::Ident;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
@ -103,7 +103,7 @@ struct ParsedField<'t> {
|
||||||
/// # Field Limits
|
/// # Field Limits
|
||||||
///
|
///
|
||||||
/// You can use the `#[multipart(limit = "<size>")]` attribute to set field level limits. The limit
|
/// You can use the `#[multipart(limit = "<size>")]` attribute to set field level limits. The limit
|
||||||
/// string is parsed using [parse_size].
|
/// string is parsed using [`bytesize`].
|
||||||
///
|
///
|
||||||
/// Note: the form is also subject to the global limits configured using `MultipartFormConfig`.
|
/// Note: the form is also subject to the global limits configured using `MultipartFormConfig`.
|
||||||
///
|
///
|
||||||
|
@ -150,7 +150,7 @@ struct ParsedField<'t> {
|
||||||
/// struct Form { }
|
/// struct Form { }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [parse_size]: https://docs.rs/parse-size/1/parse_size
|
/// [`bytesize`]: https://docs.rs/bytesize/2
|
||||||
#[proc_macro_derive(MultipartForm, attributes(multipart))]
|
#[proc_macro_derive(MultipartForm, attributes(multipart))]
|
||||||
pub fn impl_multipart_form(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
pub fn impl_multipart_form(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||||
let input: syn::DeriveInput = parse_macro_input!(input);
|
let input: syn::DeriveInput = parse_macro_input!(input);
|
||||||
|
@ -191,8 +191,8 @@ pub fn impl_multipart_form(input: proc_macro::TokenStream) -> proc_macro::TokenS
|
||||||
let attrs = FieldAttrs::from_field(field).map_err(|err| err.write_errors())?;
|
let attrs = FieldAttrs::from_field(field).map_err(|err| err.write_errors())?;
|
||||||
let serialization_name = attrs.rename.unwrap_or_else(|| rust_name.to_string());
|
let serialization_name = attrs.rename.unwrap_or_else(|| rust_name.to_string());
|
||||||
|
|
||||||
let limit = match attrs.limit.map(|limit| match parse_size(&limit) {
|
let limit = match attrs.limit.map(|limit| match limit.parse::<ByteSize>() {
|
||||||
Ok(size) => Ok(usize::try_from(size).unwrap()),
|
Ok(ByteSize(size)) => Ok(usize::try_from(size).unwrap()),
|
||||||
Err(err) => Err(syn::Error::new(
|
Err(err) => Err(syn::Error::new(
|
||||||
field.ident.as_ref().unwrap().span(),
|
field.ident.as_ref().unwrap().span(),
|
||||||
format!("Could not parse size limit `{}`: {}", limit, err),
|
format!("Could not parse size limit `{}`: {}", limit, err),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[rustversion::stable(1.72)] // MSRV
|
#[rustversion_msrv::msrv]
|
||||||
#[test]
|
#[test]
|
||||||
fn compile_macros() {
|
fn compile_macros() {
|
||||||
let t = trybuild::TestCases::new();
|
let t = trybuild::TestCases::new();
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
error: Could not parse size limit `2 bytes`: invalid digit found in string
|
error: Could not parse size limit `2 bytes`: couldn't parse "bytes" into a known SI unit, couldn't parse unit of "bytes"
|
||||||
--> tests/trybuild/size-limit-parse-fail.rs:6:5
|
--> tests/trybuild/size-limit-parse-fail.rs:6:5
|
||||||
|
|
|
|
||||||
6 | description: Text<String>,
|
6 | description: Text<String>,
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: Could not parse size limit `2 megabytes`: invalid digit found in string
|
error: Could not parse size limit `2 megabytes`: couldn't parse "megabytes" into a known SI unit, couldn't parse unit of "megabytes"
|
||||||
--> tests/trybuild/size-limit-parse-fail.rs:12:5
|
--> tests/trybuild/size-limit-parse-fail.rs:12:5
|
||||||
|
|
|
|
||||||
12 | description: Text<String>,
|
12 | description: Text<String>,
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: Could not parse size limit `four meters`: invalid digit found in string
|
error: Could not parse size limit `four meters`: couldn't parse "four meters" into a ByteSize, cannot parse float from empty string
|
||||||
--> tests/trybuild/size-limit-parse-fail.rs:18:5
|
--> tests/trybuild/size-limit-parse-fail.rs:18:5
|
||||||
|
|
|
|
||||||
18 | description: Text<String>,
|
18 | description: Text<String>,
|
||||||
|
|
|
@ -34,7 +34,7 @@ actix-web = "4"
|
||||||
|
|
||||||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||||
trybuild = "1"
|
trybuild = "1"
|
||||||
rustversion = "1"
|
rustversion-msrv = "0.100"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[rustversion::stable(1.72)] // MSRV
|
#[rustversion_msrv::msrv]
|
||||||
#[test]
|
#[test]
|
||||||
fn compile_macros() {
|
fn compile_macros() {
|
||||||
let t = trybuild::TestCases::new();
|
let t = trybuild::TestCases::new();
|
||||||
|
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 4.10.2
|
||||||
|
|
||||||
|
- No significant changes since `4.10.1`.
|
||||||
|
|
||||||
|
## 4.10.1
|
||||||
|
|
||||||
|
- No significant changes since `4.10.0`.
|
||||||
|
|
||||||
## 4.10.0
|
## 4.10.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "actix-web"
|
name = "actix-web"
|
||||||
version = "4.10.0"
|
version = "4.10.2"
|
||||||
description = "Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust"
|
description = "Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
|
@ -137,7 +137,7 @@ actix-service = "2"
|
||||||
actix-utils = "3"
|
actix-utils = "3"
|
||||||
actix-tls = { version = "3.4", default-features = false, optional = true }
|
actix-tls = { version = "3.4", default-features = false, optional = true }
|
||||||
|
|
||||||
actix-http = { version = "3.7", features = ["ws"] }
|
actix-http = { version = "3.10", features = ["ws"] }
|
||||||
actix-router = { version = "0.5.3", default-features = false, features = ["http"] }
|
actix-router = { version = "0.5.3", default-features = false, features = ["http"] }
|
||||||
actix-web-codegen = { version = "4.3", optional = true, default-features = false }
|
actix-web-codegen = { version = "4.3", optional = true, default-features = false }
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ bytes = "1"
|
||||||
bytestring = "1"
|
bytestring = "1"
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
||||||
derive_more = { version = "2", features = ["display", "error", "from"] }
|
derive_more = { version = "2", features = ["as_ref", "deref", "deref_mut", "display", "error", "from"] }
|
||||||
encoding_rs = "0.8"
|
encoding_rs = "0.8"
|
||||||
foldhash = "0.1"
|
foldhash = "0.1"
|
||||||
futures-core = { version = "0.3.17", default-features = false }
|
futures-core = { version = "0.3.17", default-features = false }
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-web)
|
[](https://crates.io/crates/actix-web)
|
||||||
[](https://docs.rs/actix-web/4.10.0)
|
[](https://docs.rs/actix-web/4.10.2)
|
||||||

|

|
||||||

|

|
||||||
[](https://deps.rs/crate/actix-web/4.10.0)
|
[](https://deps.rs/crate/actix-web/4.10.2)
|
||||||
<br />
|
<br />
|
||||||
[](https://github.com/actix/actix-web/actions/workflows/ci.yml)
|
[](https://github.com/actix/actix-web/actions/workflows/ci.yml)
|
||||||
[](https://codecov.io/gh/actix/actix-web)
|
[](https://codecov.io/gh/actix/actix-web)
|
||||||
|
|
|
@ -238,7 +238,7 @@ where
|
||||||
match res {
|
match res {
|
||||||
Ok(bytes) => {
|
Ok(bytes) => {
|
||||||
let fallback = bytes.clone();
|
let fallback = bytes.clone();
|
||||||
let left = L::from_request(this.req, &mut payload_from_bytes(bytes));
|
let left = L::from_request(this.req, &mut dev::Payload::from(bytes));
|
||||||
EitherExtractState::Left { left, fallback }
|
EitherExtractState::Left { left, fallback }
|
||||||
}
|
}
|
||||||
Err(err) => break Err(EitherExtractError::Bytes(err)),
|
Err(err) => break Err(EitherExtractError::Bytes(err)),
|
||||||
|
@ -251,7 +251,7 @@ where
|
||||||
Err(left_err) => {
|
Err(left_err) => {
|
||||||
let right = R::from_request(
|
let right = R::from_request(
|
||||||
this.req,
|
this.req,
|
||||||
&mut payload_from_bytes(mem::take(fallback)),
|
&mut dev::Payload::from(mem::take(fallback)),
|
||||||
);
|
);
|
||||||
EitherExtractState::Right {
|
EitherExtractState::Right {
|
||||||
left_err: Some(left_err),
|
left_err: Some(left_err),
|
||||||
|
@ -276,12 +276,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn payload_from_bytes(bytes: Bytes) -> dev::Payload {
|
|
||||||
let (_, mut h1_payload) = actix_http::h1::Payload::create(true);
|
|
||||||
h1_payload.unread_data(bytes);
|
|
||||||
dev::Payload::from(h1_payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -98,7 +98,7 @@ dangerous-h2c = []
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-codec = "0.5"
|
actix-codec = "0.5"
|
||||||
actix-service = "2"
|
actix-service = "2"
|
||||||
actix-http = { version = "3.7", features = ["http2", "ws"] }
|
actix-http = { version = "3.10", features = ["http2", "ws"] }
|
||||||
actix-rt = { version = "2.1", default-features = false }
|
actix-rt = { version = "2.1", default-features = false }
|
||||||
actix-tls = { version = "3.4", features = ["connect", "uri"] }
|
actix-tls = { version = "3.4", features = ["connect", "uri"] }
|
||||||
actix-utils = "3"
|
actix-utils = "3"
|
||||||
|
|
|
@ -89,9 +89,9 @@ impl Connector<()> {
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// - When the `rustls-0_23-webpki-roots` or `rustls-0_23-native-roots` features are enabled
|
/// - When the `rustls-0_23-webpki-roots` or `rustls-0_23-native-roots` features are enabled
|
||||||
/// and no default crypto provider has been loaded, this method will panic.
|
/// and no default crypto provider has been loaded, this method will panic.
|
||||||
/// - When the `rustls-0_23-native-roots` or `rustls-0_22-native-roots` features are enabled
|
/// - When the `rustls-0_23-native-roots` or `rustls-0_22-native-roots` features are enabled
|
||||||
/// and the runtime system has no native root certificates, this method will panic.
|
/// and the runtime system has no native root certificates, this method will panic.
|
||||||
#[allow(clippy::new_ret_no_self, clippy::let_unit_value)]
|
#[allow(clippy::new_ret_no_self, clippy::let_unit_value)]
|
||||||
pub fn new() -> Connector<
|
pub fn new() -> Connector<
|
||||||
impl Service<
|
impl Service<
|
||||||
|
|
|
@ -65,9 +65,7 @@ impl TestResponse {
|
||||||
|
|
||||||
/// Set response's payload
|
/// Set response's payload
|
||||||
pub fn set_payload<B: Into<Bytes>>(mut self, data: B) -> Self {
|
pub fn set_payload<B: Into<Bytes>>(mut self, data: B) -> Self {
|
||||||
let (_, mut payload) = h1::Payload::create(true);
|
self.payload = Some(Payload::from(data.into()));
|
||||||
payload.unread_data(data.into());
|
|
||||||
self.payload = Some(payload.into());
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
justfile
12
justfile
|
@ -7,14 +7,14 @@ fmt:
|
||||||
cargo +nightly fmt
|
cargo +nightly fmt
|
||||||
fd --hidden --type=file --extension=md --extension=yml --exec-batch npx -y prettier --write
|
fd --hidden --type=file --extension=md --extension=yml --exec-batch npx -y prettier --write
|
||||||
|
|
||||||
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
|
# Downgrade dependencies necessary to run MSRV checks/tests.
|
||||||
[private]
|
[private]
|
||||||
downgrade-for-msrv:
|
downgrade-for-msrv:
|
||||||
cargo update -p=parse-size --precise=1.0.0
|
cargo update -p=clap --precise=4.4.18 # next ver: 1.74.0
|
||||||
cargo update -p=clap --precise=4.4.18
|
cargo update -p=divan --precise=0.1.15 # next ver: 1.80.0
|
||||||
cargo update -p=divan --precise=0.1.15
|
cargo update -p=litemap --precise=0.7.4 # next ver: 1.81.0
|
||||||
cargo update -p=litemap --precise=0.7.4
|
cargo update -p=zerofrom --precise=0.1.5 # next ver: 1.81.0
|
||||||
cargo update -p=zerofrom --precise=0.1.5
|
cargo update -p=half --precise=2.4.1 # next ver: 1.81.0
|
||||||
|
|
||||||
msrv := ```
|
msrv := ```
|
||||||
cargo metadata --format-version=1 \
|
cargo metadata --format-version=1 \
|
||||||
|
|
Loading…
Reference in New Issue