mirror of https://github.com/fafhrd91/actix-web
parent
afd53045d4
commit
d42d01df0e
|
|
@ -82,7 +82,7 @@ dependencies = [
|
||||||
"actix-utils",
|
"actix-utils",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"base64 0.22.1",
|
"base64",
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"brotli",
|
"brotli",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -623,7 +623,7 @@ dependencies = [
|
||||||
"actix-tls",
|
"actix-tls",
|
||||||
"actix-utils",
|
"actix-utils",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"base64 0.22.1",
|
"base64",
|
||||||
"brotli",
|
"brotli",
|
||||||
"bytes",
|
"bytes",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
|
@ -680,12 +680,6 @@ dependencies = [
|
||||||
"fs_extra",
|
"fs_extra",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "base64"
|
|
||||||
version = "0.20.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.22.1"
|
version = "0.22.1"
|
||||||
|
|
@ -902,12 +896,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookie"
|
name = "cookie"
|
||||||
version = "0.16.2"
|
version = "0.18.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb"
|
checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"base64 0.20.0",
|
"base64",
|
||||||
"hkdf",
|
"hkdf",
|
||||||
"hmac",
|
"hmac",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
|
@ -2142,7 +2136,7 @@ version = "3.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be"
|
checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ actix-web-codegen = { version = "4.3", optional = true, default-features = false
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
bytestring = "1"
|
bytestring = "1"
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
cookie = { version = "0.18", features = ["percent-encode"], optional = true }
|
||||||
derive_more = { version = "2", features = ["as_ref", "deref", "deref_mut", "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"
|
||||||
|
|
|
||||||
|
|
@ -228,12 +228,12 @@ impl HttpResponseBuilder {
|
||||||
///
|
///
|
||||||
/// let res = HttpResponse::Ok()
|
/// let res = HttpResponse::Ok()
|
||||||
/// .cookie(
|
/// .cookie(
|
||||||
/// Cookie::build("name", "value")
|
/// Cookie::build(("name", "value"))
|
||||||
/// .domain("www.rust-lang.org")
|
/// .domain("www.rust-lang.org")
|
||||||
/// .path("/")
|
/// .path("/")
|
||||||
/// .secure(true)
|
/// .secure(true)
|
||||||
/// .http_only(true)
|
/// .http_only(true)
|
||||||
/// .finish(),
|
/// .build(),
|
||||||
/// )
|
/// )
|
||||||
/// .finish();
|
/// .finish();
|
||||||
/// ```
|
/// ```
|
||||||
|
|
@ -243,10 +243,10 @@ impl HttpResponseBuilder {
|
||||||
/// use actix_web::{HttpResponse, cookie::Cookie};
|
/// use actix_web::{HttpResponse, cookie::Cookie};
|
||||||
///
|
///
|
||||||
/// // the name, domain and path match the cookie created in the previous example
|
/// // the name, domain and path match the cookie created in the previous example
|
||||||
/// let mut cookie = Cookie::build("name", "value-does-not-matter")
|
/// let mut cookie = Cookie::build(("name", "value-does-not-matter"))
|
||||||
/// .domain("www.rust-lang.org")
|
/// .domain("www.rust-lang.org")
|
||||||
/// .path("/")
|
/// .path("/")
|
||||||
/// .finish();
|
/// .build();
|
||||||
/// cookie.make_removal();
|
/// cookie.make_removal();
|
||||||
///
|
///
|
||||||
/// let res = HttpResponse::Ok()
|
/// let res = HttpResponse::Ok()
|
||||||
|
|
|
||||||
|
|
@ -745,9 +745,9 @@ async fn test_server_cookies() {
|
||||||
App::new().default_service(web::to(|| async {
|
App::new().default_service(web::to(|| async {
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
.cookie(
|
.cookie(
|
||||||
Cookie::build("first", "first_value")
|
Cookie::build(("first", "first_value"))
|
||||||
.http_only(true)
|
.http_only(true)
|
||||||
.finish(),
|
.build(),
|
||||||
)
|
)
|
||||||
.cookie(Cookie::new("second", "first_value"))
|
.cookie(Cookie::new("second", "first_value"))
|
||||||
.cookie(Cookie::new("second", "second_value"))
|
.cookie(Cookie::new("second", "second_value"))
|
||||||
|
|
@ -760,9 +760,9 @@ async fn test_server_cookies() {
|
||||||
assert!(res.status().is_success());
|
assert!(res.status().is_success());
|
||||||
|
|
||||||
{
|
{
|
||||||
let first_cookie = Cookie::build("first", "first_value")
|
let first_cookie = Cookie::build(("first", "first_value"))
|
||||||
.http_only(true)
|
.http_only(true)
|
||||||
.finish();
|
.build();
|
||||||
let second_cookie = Cookie::new("second", "first_value");
|
let second_cookie = Cookie::new("second", "first_value");
|
||||||
|
|
||||||
let cookies = res.cookies().expect("To have cookies");
|
let cookies = res.cookies().expect("To have cookies");
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ serde_json = "1.0"
|
||||||
serde_urlencoded = "0.7"
|
serde_urlencoded = "0.7"
|
||||||
tokio = { version = "1.38.2", features = ["sync"] }
|
tokio = { version = "1.38.2", features = ["sync"] }
|
||||||
|
|
||||||
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
cookie = { version = "0.18", features = ["percent-encode"], optional = true }
|
||||||
|
|
||||||
tls-openssl = { package = "openssl", version = "0.10.55", optional = true }
|
tls-openssl = { package = "openssl", version = "0.10.55", optional = true }
|
||||||
tls-rustls-0_20 = { package = "rustls", version = "0.20", optional = true, features = ["dangerous_configuration"] }
|
tls-rustls-0_20 = { package = "rustls", version = "0.20", optional = true, features = ["dangerous_configuration"] }
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ mod tests {
|
||||||
let res = TestResponse::default()
|
let res = TestResponse::default()
|
||||||
.version(Version::HTTP_2)
|
.version(Version::HTTP_2)
|
||||||
.insert_header((header::DATE, HttpDate::from(SystemTime::now())))
|
.insert_header((header::DATE, HttpDate::from(SystemTime::now())))
|
||||||
.cookie(cookie::Cookie::build("name", "value").finish())
|
.cookie(cookie::Cookie::build(("name", "value")).build())
|
||||||
.finish();
|
.finish();
|
||||||
assert!(res.headers().contains_key(header::SET_COOKIE));
|
assert!(res.headers().contains_key(header::SET_COOKIE));
|
||||||
assert!(res.headers().contains_key(header::DATE));
|
assert!(res.headers().contains_key(header::DATE));
|
||||||
|
|
|
||||||
|
|
@ -543,7 +543,7 @@ mod tests {
|
||||||
.protocols(["v1", "v2"])
|
.protocols(["v1", "v2"])
|
||||||
.set_header_if_none(header::CONTENT_TYPE, "json")
|
.set_header_if_none(header::CONTENT_TYPE, "json")
|
||||||
.set_header_if_none(header::CONTENT_TYPE, "text")
|
.set_header_if_none(header::CONTENT_TYPE, "text")
|
||||||
.cookie(Cookie::build("cookie1", "value1").finish());
|
.cookie(Cookie::build(("cookie1", "value1")).build());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
req.origin.as_ref().unwrap().to_str().unwrap(),
|
req.origin.as_ref().unwrap().to_str().unwrap(),
|
||||||
"test-origin"
|
"test-origin"
|
||||||
|
|
|
||||||
|
|
@ -667,13 +667,13 @@ async fn body_streaming_implicit() {
|
||||||
async fn client_cookie_handling() {
|
async fn client_cookie_handling() {
|
||||||
use std::io::{Error as IoError, ErrorKind};
|
use std::io::{Error as IoError, ErrorKind};
|
||||||
|
|
||||||
let cookie1 = Cookie::build("cookie1", "value1").finish();
|
let cookie1 = Cookie::build(("cookie1", "value1")).build();
|
||||||
let cookie2 = Cookie::build("cookie2", "value2")
|
let cookie2 = Cookie::build(("cookie2", "value2"))
|
||||||
.domain("www.example.org")
|
.domain("www.example.org")
|
||||||
.path("/")
|
.path("/")
|
||||||
.secure(true)
|
.secure(true)
|
||||||
.http_only(true)
|
.http_only(true)
|
||||||
.finish();
|
.build();
|
||||||
// Q: are all these clones really necessary? A: Yes, possibly
|
// Q: are all these clones really necessary? A: Yes, possibly
|
||||||
let cookie1b = cookie1.clone();
|
let cookie1b = cookie1.clone();
|
||||||
let cookie2b = cookie2.clone();
|
let cookie2b = cookie2.clone();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue