Merge branch 'master' into channel-body-type

This commit is contained in:
yinho999 2023-05-31 08:47:41 +01:00 committed by GitHub
commit e600c065c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 21 additions and 8 deletions

View File

@ -101,7 +101,6 @@ jobs:
run: > run: >
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=stable cargo test --lib --tests -p=actix-files --all-features" sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=stable cargo test --lib --tests -p=actix-files --all-features"
rustdoc: rustdoc:
name: doc tests name: doc tests
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -26,7 +26,7 @@ actix-service = "2"
actix-utils = "3" actix-utils = "3"
actix-web = { version = "4", default-features = false } actix-web = { version = "4", default-features = false }
bitflags = "1" bitflags = "2"
bytes = "1" bytes = "1"
derive_more = "0.99.5" derive_more = "0.99.5"
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] } futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }

View File

@ -29,6 +29,7 @@ use mime_guess::from_path;
use crate::{encoding::equiv_utf8_text, range::HttpRange}; use crate::{encoding::equiv_utf8_text, range::HttpRange};
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy)]
pub(crate) struct Flags: u8 { pub(crate) struct Flags: u8 {
const ETAG = 0b0000_0001; const ETAG = 0b0000_0001;
const LAST_MD = 0b0000_0010; const LAST_MD = 0b0000_0010;

View File

@ -62,7 +62,7 @@ actix-utils = "3"
actix-rt = { version = "2.2", default-features = false } actix-rt = { version = "2.2", default-features = false }
ahash = "0.8" ahash = "0.8"
bitflags = "1.2" bitflags = "2"
bytes = "1" bytes = "1"
bytestring = "1" bytestring = "1"
derive_more = "0.99.5" derive_more = "0.99.5"

View File

@ -16,6 +16,7 @@ use crate::{
}; };
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy)]
struct Flags: u8 { struct Flags: u8 {
const HEAD = 0b0000_0001; const HEAD = 0b0000_0001;
const KEEP_ALIVE_ENABLED = 0b0000_1000; const KEEP_ALIVE_ENABLED = 0b0000_1000;

View File

@ -14,6 +14,7 @@ use crate::{
}; };
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy)]
struct Flags: u8 { struct Flags: u8 {
const HEAD = 0b0000_0001; const HEAD = 0b0000_0001;
const KEEP_ALIVE_ENABLED = 0b0000_0010; const KEEP_ALIVE_ENABLED = 0b0000_0010;

View File

@ -40,6 +40,7 @@ const HW_BUFFER_SIZE: usize = 1024 * 8;
const MAX_PIPELINED_MESSAGES: usize = 16; const MAX_PIPELINED_MESSAGES: usize = 16;
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy)]
pub struct Flags: u8 { pub struct Flags: u8 {
/// Set when stream is read for first time. /// Set when stream is read for first time.
const STARTED = 0b0000_0001; const STARTED = 0b0000_0001;

View File

@ -16,6 +16,7 @@ pub enum ConnectionType {
} }
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy)]
pub(crate) struct Flags: u8 { pub(crate) struct Flags: u8 {
const CLOSE = 0b0000_0001; const CLOSE = 0b0000_0001;
const KEEP_ALIVE = 0b0000_0010; const KEEP_ALIVE = 0b0000_0010;

View File

@ -74,6 +74,7 @@ pub struct Codec {
} }
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy)]
struct Flags: u8 { struct Flags: u8 {
const SERVER = 0b0000_0001; const SERVER = 0b0000_0001;
const CONTINUATION = 0b0000_0010; const CONTINUATION = 0b0000_0010;

View File

@ -1,3 +1,4 @@
use std::cmp::min;
use std::convert::TryFrom; use std::convert::TryFrom;
use bytes::{Buf, BufMut, BytesMut}; use bytes::{Buf, BufMut, BytesMut};
@ -96,6 +97,10 @@ impl Parser {
// not enough data // not enough data
if src.len() < idx + length { if src.len() < idx + length {
let min_length = min(length, max_size);
if src.capacity() < idx + min_length {
src.reserve(idx + min_length - src.capacity());
}
return Ok(None); return Ok(None);
} }

View File

@ -917,9 +917,9 @@
### Changed ### Changed
- Updated actix-web-codegen dependency for access to new `#[route(...)]` multi-method macro. - Updated `actix-web-codegen` dependency for access to new `#[route(...)]` multi-method macro.
- Print non-configured `Data<T>` type when attempting extraction. [#1743] - Print non-configured `Data<T>` type when attempting extraction. [#1743]
- Re-export bytes::Buf{Mut} in web module. [#1750] - Re-export `bytes::Buf{Mut}` in web module. [#1750]
- Upgrade `pin-project` to `1.0`. - Upgrade `pin-project` to `1.0`.
[#1723]: https://github.com/actix/actix-web/pull/1723 [#1723]: https://github.com/actix/actix-web/pull/1723
@ -927,6 +927,7 @@
[#1748]: https://github.com/actix/actix-web/pull/1748 [#1748]: https://github.com/actix/actix-web/pull/1748
[#1750]: https://github.com/actix/actix-web/pull/1750 [#1750]: https://github.com/actix/actix-web/pull/1750
[#1754]: https://github.com/actix/actix-web/pull/1754 [#1754]: https://github.com/actix/actix-web/pull/1754
[#1757]: https://github.com/actix/actix-web/pull/1757
[#1749]: https://github.com/actix/actix-web/pull/1749 [#1749]: https://github.com/actix/actix-web/pull/1749
## 3.1.0 - 2020-09-29 ## 3.1.0 - 2020-09-29

View File

@ -31,7 +31,6 @@ Headings marked with :warning: are **breaking behavioral changes**. They will pr
- [Returning `HttpResponse` synchronously](#returning-httpresponse-synchronously) - [Returning `HttpResponse` synchronously](#returning-httpresponse-synchronously)
- [`#[actix_web::main]` and `#[tokio::main]`](#actix_webmain-and-tokiomain) - [`#[actix_web::main]` and `#[tokio::main]`](#actix_webmain-and-tokiomain)
- [`web::block`](#webblock) - [`web::block`](#webblock)
-
## MSRV ## MSRV

View File

@ -18,6 +18,7 @@
//! There are shortcuts for routes with method guards in the [`web`](crate::web) module: //! There are shortcuts for routes with method guards in the [`web`](crate::web) module:
//! [`web::get()`](crate::web::get), [`web::post()`](crate::web::post), etc. The routes created by //! [`web::get()`](crate::web::get), [`web::post()`](crate::web::post), etc. The routes created by
//! the following calls are equivalent: //! the following calls are equivalent:
//!
//! - `web::get()` (recommended form) //! - `web::get()` (recommended form)
//! - `web::route().guard(guard::Get())` //! - `web::route().guard(guard::Get())`
//! //!
@ -28,9 +29,11 @@
//! would result in inaccessible routes. See the [`Host`] guard for an example of virtual hosting. //! would result in inaccessible routes. See the [`Host`] guard for an example of virtual hosting.
//! //!
//! # Examples //! # Examples
//!
//! In the following code, the `/guarded` resource has one defined route whose handler will only be //! In the following code, the `/guarded` resource has one defined route whose handler will only be
//! called if the request method is `POST` and there is a request header with name and value equal //! called if the request method is GET or POST and there is a `x-guarded` request header with value
//! to `x-guarded` and `secret`, respectively. //! equal to `secret`.
//!
//! ``` //! ```
//! use actix_web::{web, http::Method, guard, HttpResponse}; //! use actix_web::{web, http::Method, guard, HttpResponse};
//! //!