mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-15 14:26:15 +02:00
Compare commits
4 Commits
web-v3.3.1
...
web-v3.3.2
Author | SHA1 | Date | |
---|---|---|---|
|
24d525d978 | ||
|
1f70ef155d | ||
|
7981e0068a | ||
|
32d59ca904 |
13
CHANGES.md
13
CHANGES.md
@@ -1,7 +1,20 @@
|
||||
# Changes
|
||||
|
||||
## Unreleased - 2020-xx-xx
|
||||
|
||||
|
||||
## 3.3.2 - 2020-12-01
|
||||
### Fixed
|
||||
* Removed an occasional `unwrap` on `None` panic in `NormalizePathNormalization`. [#1762]
|
||||
* Fix `match_pattern()` returning `None` for scope with empty path resource. [#1798]
|
||||
* Increase minimum `socket2` version. [#1803]
|
||||
|
||||
[#1762]: https://github.com/actix/actix-web/pull/1762
|
||||
[#1798]: https://github.com/actix/actix-web/pull/1798
|
||||
[#1803]: https://github.com/actix/actix-web/pull/1803
|
||||
|
||||
|
||||
## 3.3.1 - 2020-11-29
|
||||
* Ensure `actix-http` dependency uses same `serde_urlencoded`.
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-web"
|
||||
version = "3.3.1"
|
||||
version = "3.3.2"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust"
|
||||
readme = "README.md"
|
||||
@@ -97,7 +97,7 @@ futures-util = { version = "0.3.5", default-features = false }
|
||||
fxhash = "0.2.1"
|
||||
log = "0.4"
|
||||
mime = "0.3"
|
||||
socket2 = "0.3"
|
||||
socket2 = "0.3.16"
|
||||
pin-project = "1.0.0"
|
||||
regex = "1.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
@@ -6,10 +6,10 @@
|
||||
<p>
|
||||
|
||||
[](https://crates.io/crates/actix-web)
|
||||
[](https://docs.rs/actix-web/3.3.1)
|
||||
[](https://docs.rs/actix-web/3.3.2)
|
||||
[](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html)
|
||||

|
||||
[](https://deps.rs/crate/actix-web/3.3.1)
|
||||
[](https://deps.rs/crate/actix-web/3.3.2)
|
||||
<br />
|
||||
[](https://travis-ci.org/actix/actix-web)
|
||||
[](https://codecov.io/gh/actix/actix-web)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
# Changes
|
||||
|
||||
## Unreleased - 2020-xx-xx
|
||||
|
||||
|
||||
## 2.0.3 - 2020-11-29
|
||||
### Fixed
|
||||
* Ensure `actix-http` dependency uses same `serde_urlencoded`.
|
||||
|
||||
|
@@ -137,9 +137,9 @@ where
|
||||
// so the change can not be deduced from the length comparison
|
||||
if path != original_path {
|
||||
let mut parts = head.uri.clone().into_parts();
|
||||
let pq = parts.path_and_query.as_ref().unwrap();
|
||||
let query = parts.path_and_query.as_ref().and_then(|pq| pq.query());
|
||||
|
||||
let path = if let Some(q) = pq.query() {
|
||||
let path = if let Some(q) = query {
|
||||
Bytes::from(format!("{}?{}", path, q))
|
||||
} else {
|
||||
Bytes::copy_from_slice(path.as_bytes())
|
||||
|
@@ -675,4 +675,40 @@ mod tests {
|
||||
let res = call_service(&mut srv, req).await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn extract_path_pattern_complex() {
|
||||
let mut srv = init_service(
|
||||
App::new()
|
||||
.service(web::scope("/user").service(web::scope("/{id}").service(
|
||||
web::resource("").to(move |req: HttpRequest| {
|
||||
assert_eq!(req.match_pattern(), Some("/user/{id}".to_owned()));
|
||||
|
||||
HttpResponse::Ok().finish()
|
||||
}),
|
||||
)))
|
||||
.service(web::resource("/").to(move |req: HttpRequest| {
|
||||
assert_eq!(req.match_pattern(), Some("/".to_owned()));
|
||||
|
||||
HttpResponse::Ok().finish()
|
||||
}))
|
||||
.default_service(web::to(move |req: HttpRequest| {
|
||||
assert!(req.match_pattern().is_none());
|
||||
HttpResponse::Ok().finish()
|
||||
})),
|
||||
)
|
||||
.await;
|
||||
|
||||
let req = TestRequest::get().uri("/user/test").to_request();
|
||||
let res = call_service(&mut srv, req).await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
|
||||
let req = TestRequest::get().uri("/").to_request();
|
||||
let res = call_service(&mut srv, req).await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
|
||||
let req = TestRequest::get().uri("/not-exist").to_request();
|
||||
let res = call_service(&mut srv, req).await;
|
||||
assert_eq!(res.status(), StatusCode::OK);
|
||||
}
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ impl ResourceMap {
|
||||
if let Some(plen) = pattern.is_prefix_match(path) {
|
||||
return rmap.has_resource(&path[plen..]);
|
||||
}
|
||||
} else if pattern.is_match(path) {
|
||||
} else if pattern.is_match(path) || pattern.pattern() == "" && path == "/" {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user