mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-16 14:45:47 +02:00
Compare commits
9 Commits
multipart-
...
http-v3.0.
Author | SHA1 | Date | |
---|---|---|---|
|
da4c849f62 | ||
|
49cd303c3b | ||
|
955c3ac0c4 | ||
|
56e5c19b85 | ||
|
3f03af1c59 | ||
|
25c0673278 | ||
|
e7a05f9892 | ||
|
2f13e5f675 | ||
|
9f964751f6 |
@@ -1,6 +1,9 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
- Add support for streaming audio files by setting the `content-disposition` header `inline` instead of `attachement`. [#2645]
|
||||||
|
|
||||||
|
[#2645]: https://github.com/actix/actix-web/pull/2645
|
||||||
|
|
||||||
|
|
||||||
## 0.6.0 - 2022-02-25
|
## 0.6.0 - 2022-02-25
|
||||||
|
@@ -128,7 +128,7 @@ impl NamedFile {
|
|||||||
let ct = from_path(&path).first_or_octet_stream();
|
let ct = from_path(&path).first_or_octet_stream();
|
||||||
|
|
||||||
let disposition = match ct.type_() {
|
let disposition = match ct.type_() {
|
||||||
mime::IMAGE | mime::TEXT | mime::VIDEO => DispositionType::Inline,
|
mime::IMAGE | mime::TEXT | mime::AUDIO | mime::VIDEO => DispositionType::Inline,
|
||||||
mime::APPLICATION => match ct.subtype() {
|
mime::APPLICATION => match ct.subtype() {
|
||||||
mime::JAVASCRIPT | mime::JSON => DispositionType::Inline,
|
mime::JAVASCRIPT | mime::JSON => DispositionType::Inline,
|
||||||
name if name == "wasm" => DispositionType::Inline,
|
name if name == "wasm" => DispositionType::Inline,
|
||||||
|
@@ -3,6 +3,11 @@
|
|||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
|
||||||
|
|
||||||
|
## 3.0.1 - 2022-03-04
|
||||||
|
- Fix panic in H1 dispatcher when pipelining is used with keep-alive. [#2678]
|
||||||
|
|
||||||
|
[#2678]: https://github.com/actix/actix-web/issues/2678
|
||||||
|
|
||||||
## 3.0.0 - 2022-02-25
|
## 3.0.0 - 2022-02-25
|
||||||
### Dependencies
|
### Dependencies
|
||||||
- Updated `actix-*` to Tokio v1-based versions. [#1813]
|
- Updated `actix-*` to Tokio v1-based versions. [#1813]
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
|
@@ -3,11 +3,11 @@
|
|||||||
> HTTP primitives for the Actix ecosystem.
|
> HTTP primitives for the Actix ecosystem.
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-http)
|
[](https://crates.io/crates/actix-http)
|
||||||
[](https://docs.rs/actix-http/3.0.0)
|
[](https://docs.rs/actix-http/3.0.1)
|
||||||
[](https://blog.rust-lang.org/2021/05/06/Rust-1.54.0.html)
|
[](https://blog.rust-lang.org/2021/05/06/Rust-1.54.0.html)
|
||||||

|

|
||||||
<br />
|
<br />
|
||||||
[](https://deps.rs/crate/actix-http/3.0.0)
|
[](https://deps.rs/crate/actix-http/3.0.1)
|
||||||
[](https://crates.io/crates/actix-http)
|
[](https://crates.io/crates/actix-http)
|
||||||
[](https://discord.gg/NWpN5mmg3x)
|
[](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
@@ -375,8 +375,6 @@ where
|
|||||||
DispatchError::Io(err)
|
DispatchError::Io(err)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
this.flags.set(Flags::KEEP_ALIVE, this.codec.keep_alive());
|
|
||||||
|
|
||||||
Ok(size)
|
Ok(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +457,12 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// all messages are dealt with
|
// all messages are dealt with
|
||||||
None => return Ok(PollResponse::DoNothing),
|
None => {
|
||||||
|
// start keep-alive if last request allowed it
|
||||||
|
this.flags.set(Flags::KEEP_ALIVE, this.codec.keep_alive());
|
||||||
|
|
||||||
|
return Ok(PollResponse::DoNothing);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
StateProj::ServiceCall { fut } => {
|
StateProj::ServiceCall { fut } => {
|
||||||
@@ -757,6 +760,7 @@ where
|
|||||||
|
|
||||||
let mut updated = false;
|
let mut updated = false;
|
||||||
|
|
||||||
|
// decode from read buf as many full requests as possible
|
||||||
loop {
|
loop {
|
||||||
match this.codec.decode(this.read_buf) {
|
match this.codec.decode(this.read_buf) {
|
||||||
Ok(Some(msg)) => {
|
Ok(Some(msg)) => {
|
||||||
|
@@ -3,6 +3,12 @@
|
|||||||
## Unreleased - 2021-xx-xx
|
## Unreleased - 2021-xx-xx
|
||||||
|
|
||||||
|
|
||||||
|
## 4.1.0 - 2022-03-02
|
||||||
|
- Add support for `actix` version `0.13`. [#2675]
|
||||||
|
|
||||||
|
[#2675]: https://github.com/actix/actix-web/pull/2675
|
||||||
|
|
||||||
|
|
||||||
## 4.0.0 - 2022-02-25
|
## 4.0.0 - 2022-02-25
|
||||||
- No significant changes since `4.0.0-beta.12`.
|
- No significant changes since `4.0.0-beta.12`.
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web-actors"
|
name = "actix-web-actors"
|
||||||
version = "4.0.0"
|
version = "4.1.0"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix actors support for Actix Web"
|
description = "Actix actors support for Actix Web"
|
||||||
keywords = ["actix", "http", "web", "framework", "async"]
|
keywords = ["actix", "http", "web", "framework", "async"]
|
||||||
@@ -14,16 +14,16 @@ name = "actix_web_actors"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = { version = "0.12.0", default-features = false }
|
actix = { version = ">=0.12, <0.14", default-features = false }
|
||||||
actix-codec = "0.5"
|
actix-codec = "0.5"
|
||||||
actix-http = "3.0.0"
|
actix-http = "3"
|
||||||
actix-web = { version = "4.0.0", default-features = false }
|
actix-web = { version = "4", default-features = false }
|
||||||
|
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
bytestring = "1"
|
bytestring = "1"
|
||||||
futures-core = { version = "0.3.7", default-features = false }
|
futures-core = { version = "0.3.7", default-features = false }
|
||||||
pin-project-lite = "0.2"
|
pin-project-lite = "0.2"
|
||||||
tokio = { version = "1.8.4", features = ["sync"] }
|
tokio = { version = "1.13.1", features = ["sync"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2.2"
|
actix-rt = "2.2"
|
||||||
|
@@ -3,11 +3,11 @@
|
|||||||
> Actix actors support for Actix Web.
|
> Actix actors support for Actix Web.
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-web-actors)
|
[](https://crates.io/crates/actix-web-actors)
|
||||||
[](https://docs.rs/actix-web-actors/4.0.0)
|
[](https://docs.rs/actix-web-actors/4.1.0)
|
||||||
[](https://blog.rust-lang.org/2021/05/06/Rust-1.54.0.html)
|
[](https://blog.rust-lang.org/2021/05/06/Rust-1.54.0.html)
|
||||||

|

|
||||||
<br />
|
<br />
|
||||||
[](https://deps.rs/crate/actix-web-actors/4.0.0)
|
[](https://deps.rs/crate/actix-web-actors/4.1.0)
|
||||||
[](https://crates.io/crates/actix-web-actors)
|
[](https://crates.io/crates/actix-web-actors)
|
||||||
[](https://discord.gg/NWpN5mmg3x)
|
[](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
|
|
||||||
## 4.0.1 - 2022-02-25
|
## 4.0.1 - 2022-02-25
|
||||||
- No significant changes since `4.0.0`.
|
### Fixed
|
||||||
|
- Use stable version in readme example.
|
||||||
|
|
||||||
|
|
||||||
## 4.0.0 - 2022-02-25
|
## 4.0.0 - 2022-02-25
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
This guide walks you through the process of migrating from v3.x.y to v4.x.y.
|
This guide walks you through the process of migrating from v3.x.y to v4.x.y.
|
||||||
If you are migrating to v4.x.y from an older version of Actix Web (v2.x.y or earlier), check out the other historical migration notes in this folder.
|
If you are migrating to v4.x.y from an older version of Actix Web (v2.x.y or earlier), check out the other historical migration notes in this folder.
|
||||||
|
|
||||||
This document is not designed to be exhaustive—it focuses on the most significant changes coming in v4. You can find an exhaustive changelog in the changelogs for [`actix-web`](./CHANGES.md#400---2022-02-25) and [`actix-http`](../actix-http/CHANGES.md#300---2022-02-25), complete of PR links. If you think that some of the changes that we omitted deserve to be called out in this document, please open an issue or submit a PR.
|
This document is not designed to be exhaustive—it focuses on the most significant changes in v4. You can find an exhaustive changelog in the changelogs for [`actix-web`](./CHANGES.md#400---2022-02-25) and [`actix-http`](../actix-http/CHANGES.md#300---2022-02-25), complete with PR links. If you think there are any changes that deserve to be called out in this document, please open an issue or pull request.
|
||||||
|
|
||||||
Headings marked with :warning: are **breaking behavioral changes**. They will probably not surface as compile-time errors though automated tests _might_ detect their effects on your app.
|
Headings marked with :warning: are **breaking behavioral changes**. They will probably not surface as compile-time errors though automated tests _might_ detect their effects on your app.
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ Headings marked with :warning: are **breaking behavioral changes**. They will pr
|
|||||||
- [Server Must Be Polled :warning:](#server-must-be-polled-warning)
|
- [Server Must Be Polled :warning:](#server-must-be-polled-warning)
|
||||||
- [Guards API](#guards-api)
|
- [Guards API](#guards-api)
|
||||||
- [Returning `HttpResponse` synchronously](#returning-httpresponse-synchronously)
|
- [Returning `HttpResponse` synchronously](#returning-httpresponse-synchronously)
|
||||||
- [`#[actix_web::main]` and `#[tokio::main]`](#actixwebmain-and-tokiomain)
|
- [`#[actix_web::main]` and `#[tokio::main]`](#actix_webmain-and-tokiomain)
|
||||||
- [`web::block`](#webblock)
|
- [`web::block`](#webblock)
|
||||||
|
|
||||||
## MSRV
|
## MSRV
|
||||||
@@ -111,6 +111,8 @@ The inner field for `web::Path` is now private. It was causing ambiguity when tr
|
|||||||
+ let (foo, bar) = params.into_inner();
|
+ let (foo, bar) = params.into_inner();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
An alternative [path param type with public field but no `Deref` impl is available in `actix-web-lab`](https://docs.rs/actix-web-lab/0.12.0/actix_web_lab/extract/struct.Path.html).
|
||||||
|
|
||||||
## Rustls Crate Upgrade
|
## Rustls Crate Upgrade
|
||||||
|
|
||||||
Actix Web now depends on version 0.20 of `rustls`. As a result, the server config builder has changed. [See the updated example project.](https://github.com/actix/examples/tree/master/https-tls/rustls/)
|
Actix Web now depends on version 0.20 of `rustls`. As a result, the server config builder has changed. [See the updated example project.](https://github.com/actix/examples/tree/master/https-tls/rustls/)
|
||||||
|
@@ -159,7 +159,7 @@ impl ConnectionInfo {
|
|||||||
pub fn realip_remote_addr(&self) -> Option<&str> {
|
pub fn realip_remote_addr(&self) -> Option<&str> {
|
||||||
self.realip_remote_addr
|
self.realip_remote_addr
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.or_else(|| self.peer_addr.as_deref())
|
.or(self.peer_addr.as_deref())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns serialized IP address of the peer connection.
|
/// Returns serialized IP address of the peer connection.
|
||||||
|
@@ -151,7 +151,7 @@ impl ResourceMap {
|
|||||||
.char_indices()
|
.char_indices()
|
||||||
.filter_map(|(i, c)| (c == '/').then(|| i))
|
.filter_map(|(i, c)| (c == '/').then(|| i))
|
||||||
.nth(2)
|
.nth(2)
|
||||||
.unwrap_or_else(|| path.len());
|
.unwrap_or(path.len());
|
||||||
|
|
||||||
(
|
(
|
||||||
Cow::Borrowed(&path[..third_slash_index]),
|
Cow::Borrowed(&path[..third_slash_index]),
|
||||||
|
@@ -24,10 +24,10 @@ use crate::cookie::{Cookie, CookieJar};
|
|||||||
///
|
///
|
||||||
/// For unit testing, actix provides a request builder type and a simple handler runner. TestRequest implements a builder-like pattern.
|
/// For unit testing, actix provides a request builder type and a simple handler runner. TestRequest implements a builder-like pattern.
|
||||||
/// You can generate various types of request via TestRequest's methods:
|
/// You can generate various types of request via TestRequest's methods:
|
||||||
/// * `TestRequest::to_request` creates `actix_http::Request` instance.
|
/// - [`TestRequest::to_request`] creates an [`actix_http::Request`](Request).
|
||||||
/// * `TestRequest::to_srv_request` creates `ServiceRequest` instance, which is used for testing middlewares and chain adapters.
|
/// - [`TestRequest::to_srv_request`] creates a [`ServiceRequest`], which is used for testing middlewares and chain adapters.
|
||||||
/// * `TestRequest::to_srv_response` creates `ServiceResponse` instance.
|
/// - [`TestRequest::to_srv_response`] creates a [`ServiceResponse`].
|
||||||
/// * `TestRequest::to_http_request` creates `HttpRequest` instance, which is used for testing handlers.
|
/// - [`TestRequest::to_http_request`] creates an [`HttpRequest`], which is used for testing handlers.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use actix_web::{test, HttpRequest, HttpResponse, HttpMessage};
|
/// use actix_web::{test, HttpRequest, HttpResponse, HttpMessage};
|
||||||
@@ -42,15 +42,17 @@ use crate::cookie::{Cookie, CookieJar};
|
|||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// #[actix_web::test]
|
/// #[actix_web::test]
|
||||||
|
/// # // force rustdoc to display the correct thing and also compile check the test
|
||||||
|
/// # async fn _test() {}
|
||||||
/// async fn test_index() {
|
/// async fn test_index() {
|
||||||
/// let req = test::TestRequest::default().insert_header("content-type", "text/plain")
|
/// let req = test::TestRequest::default().insert_header(header::ContentType::plaintext())
|
||||||
/// .to_http_request();
|
/// .to_http_request();
|
||||||
///
|
///
|
||||||
/// let resp = index(req).await.unwrap();
|
/// let resp = index(req).await;
|
||||||
/// assert_eq!(resp.status(), StatusCode::OK);
|
/// assert_eq!(resp.status(), StatusCode::OK);
|
||||||
///
|
///
|
||||||
/// let req = test::TestRequest::default().to_http_request();
|
/// let req = test::TestRequest::default().to_http_request();
|
||||||
/// let resp = index(req).await.unwrap();
|
/// let resp = index(req).await;
|
||||||
/// assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
/// assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
Reference in New Issue
Block a user