mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-07 03:10:17 +02:00
Compare commits
5 Commits
cors-v0.1.
...
http-v0.2.
Author | SHA1 | Date | |
---|---|---|---|
d2b6502c7a | |||
7c0f570845 | |||
eaa371db8b | |||
d293ae2a69 | |||
d7ec241fd0 |
@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
* Re-apply patch from #637 #894
|
* Re-apply patch from #637 #894
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* HttpRequest::url_for is broken with nested scopes #915
|
||||||
|
|
||||||
|
|
||||||
## [1.0.0] - 2019-06-05
|
## [1.0.0] - 2019-06-05
|
||||||
|
|
||||||
|
18
Cargo.toml
18
Cargo.toml
@ -43,7 +43,7 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["brotli", "flate2-zlib", "client", "fail"]
|
default = ["brotli", "flate2-zlib", "client", "fail", "depracated"]
|
||||||
|
|
||||||
# http client
|
# http client
|
||||||
client = ["awc"]
|
client = ["awc"]
|
||||||
@ -68,6 +68,9 @@ ssl = ["openssl", "actix-server/ssl", "awc/ssl"]
|
|||||||
# rustls
|
# rustls
|
||||||
rust-tls = ["rustls", "actix-server/rust-tls"]
|
rust-tls = ["rustls", "actix-server/rust-tls"]
|
||||||
|
|
||||||
|
# deprecated middlewares
|
||||||
|
depracated = ["actix-cors", "actix-identity"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-codec = "0.1.2"
|
actix-codec = "0.1.2"
|
||||||
actix-service = "0.4.0"
|
actix-service = "0.4.0"
|
||||||
@ -81,13 +84,15 @@ actix-server-config = "0.1.1"
|
|||||||
actix-threadpool = "0.1.1"
|
actix-threadpool = "0.1.1"
|
||||||
awc = { version = "0.2.1", optional = true }
|
awc = { version = "0.2.1", optional = true }
|
||||||
|
|
||||||
# actix-cors = "0.1."{ path="./actix-cors" }
|
# deprecated middlewares
|
||||||
|
actix-cors = { version = "0.1.0", optional = true }
|
||||||
|
actix-identity = { version = "0.1.0", optional = true }
|
||||||
|
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
derive_more = "0.14"
|
derive_more = "0.15.0"
|
||||||
encoding = "0.2"
|
encoding = "0.2"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
hashbrown = "0.3.0"
|
hashbrown = "0.5.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime = "0.3"
|
mime = "0.3"
|
||||||
net2 = "0.2.33"
|
net2 = "0.2.33"
|
||||||
@ -104,10 +109,9 @@ openssl = { version="0.10", optional = true }
|
|||||||
rustls = { version = "0.15", optional = true }
|
rustls = { version = "0.15", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
actix = { version = "0.8.3" }
|
||||||
actix-http = { version = "0.2.3", features=["ssl", "brotli", "flate2-zlib"] }
|
actix-http = { version = "0.2.3", features=["ssl", "brotli", "flate2-zlib"] }
|
||||||
actix-http-test = { version = "0.2.0", features=["ssl"] }
|
actix-http-test = { version = "0.2.0", features=["ssl"] }
|
||||||
actix-files = "0.1.1"
|
|
||||||
actix = { version = "0.8.3" }
|
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
@ -121,7 +125,7 @@ opt-level = 3
|
|||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
actix-web = { path = "." }
|
# actix-web = { path = "." }
|
||||||
actix-http = { path = "actix-http" }
|
actix-http = { path = "actix-http" }
|
||||||
actix-http-test = { path = "test-server" }
|
actix-http-test = { path = "test-server" }
|
||||||
actix-web-codegen = { path = "actix-web-codegen" }
|
actix-web-codegen = { path = "actix-web-codegen" }
|
||||||
|
14
MIGRATION.md
14
MIGRATION.md
@ -1,5 +1,19 @@
|
|||||||
## 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
|
* Cors middleware has been moved to `actix-cors` crate
|
||||||
|
|
||||||
|
instead of
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use actix_web::middleware::cors::Cors;
|
||||||
|
```
|
||||||
|
|
||||||
|
use
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use actix_cors::Cors;
|
||||||
|
```
|
||||||
|
|
||||||
* Identity middleware has been moved to `actix-identity` crate
|
* Identity middleware has been moved to `actix-identity` crate
|
||||||
|
|
||||||
instead of
|
instead of
|
||||||
|
@ -4,13 +4,13 @@ version = "0.1.0"
|
|||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Cross-origin resource sharing (CORS) for Actix applications."
|
description = "Cross-origin resource sharing (CORS) for Actix applications."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["http", "web", "framework", "async", "futures"]
|
keywords = ["web", "framework"]
|
||||||
homepage = "https://actix.rs"
|
homepage = "https://actix.rs"
|
||||||
repository = "https://github.com/actix/actix-web.git"
|
repository = "https://github.com/actix/actix-web.git"
|
||||||
documentation = "https://docs.rs/actix-cors/"
|
documentation = "https://docs.rs/actix-cors/"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
workspace = ".."
|
#workspace = ".."
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "actix_cors"
|
name = "actix_cors"
|
||||||
@ -21,8 +21,3 @@ actix-web = "1.0.0"
|
|||||||
actix-service = "0.4.0"
|
actix-service = "0.4.0"
|
||||||
derive_more = "0.14.1"
|
derive_more = "0.14.1"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
actix-rt = "0.2.2"
|
|
||||||
#actix-http = "0.2.3"
|
|
||||||
#bytes = "0.4"
|
|
@ -1,5 +1,12 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## [0.2.4] - 2019-06-16
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Do not compress NoContent (204) responses #918
|
||||||
|
|
||||||
|
|
||||||
## [0.2.3] - 2019-06-02
|
## [0.2.3] - 2019-06-02
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-http"
|
name = "actix-http"
|
||||||
version = "0.2.3"
|
version = "0.2.4"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix http primitives"
|
description = "Actix http primitives"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -56,11 +56,11 @@ bitflags = "1.0"
|
|||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
byteorder = "1.2"
|
byteorder = "1.2"
|
||||||
copyless = "0.1.2"
|
copyless = "0.1.2"
|
||||||
derive_more = "0.14"
|
derive_more = "0.15.0"
|
||||||
either = "1.5.2"
|
either = "1.5.2"
|
||||||
encoding = "0.2"
|
encoding = "0.2"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
hashbrown = "0.3.0"
|
hashbrown = "0.5.0"
|
||||||
h2 = "0.1.16"
|
h2 = "0.1.16"
|
||||||
http = "0.1.17"
|
http = "0.1.17"
|
||||||
httparse = "1.3"
|
httparse = "1.3"
|
||||||
|
@ -33,6 +33,7 @@ impl<B: MessageBody> Encoder<B> {
|
|||||||
) -> ResponseBody<Encoder<B>> {
|
) -> ResponseBody<Encoder<B>> {
|
||||||
let can_encode = !(head.headers().contains_key(&CONTENT_ENCODING)
|
let can_encode = !(head.headers().contains_key(&CONTENT_ENCODING)
|
||||||
|| head.status == StatusCode::SWITCHING_PROTOCOLS
|
|| head.status == StatusCode::SWITCHING_PROTOCOLS
|
||||||
|
|| head.status == StatusCode::NO_CONTENT
|
||||||
|| encoding == ContentEncoding::Identity
|
|| encoding == ContentEncoding::Identity
|
||||||
|| encoding == ContentEncoding::Auto);
|
|| encoding == ContentEncoding::Auto);
|
||||||
|
|
||||||
|
@ -225,7 +225,6 @@ where
|
|||||||
/// It is also possible to use static files as default service.
|
/// It is also possible to use static files as default service.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use actix_files::Files;
|
|
||||||
/// use actix_web::{web, App, HttpResponse};
|
/// use actix_web::{web, App, HttpResponse};
|
||||||
///
|
///
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
@ -233,7 +232,7 @@ where
|
|||||||
/// .service(
|
/// .service(
|
||||||
/// web::resource("/index.html").to(|| HttpResponse::Ok()))
|
/// web::resource("/index.html").to(|| HttpResponse::Ok()))
|
||||||
/// .default_service(
|
/// .default_service(
|
||||||
/// Files::new("", "./static")
|
/// web::to(|| HttpResponse::NotFound())
|
||||||
/// );
|
/// );
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -11,5 +11,16 @@ pub use self::defaultheaders::DefaultHeaders;
|
|||||||
pub use self::logger::Logger;
|
pub use self::logger::Logger;
|
||||||
pub use self::normalize::NormalizePath;
|
pub use self::normalize::NormalizePath;
|
||||||
|
|
||||||
//
|
#[cfg(feature = "deprecated")]
|
||||||
// use actix_cors as cors;
|
#[deprecated(
|
||||||
|
since = "1.0.1",
|
||||||
|
note = "please use `actix_cors` instead. support will be removed in actix-web 1.0.2"
|
||||||
|
)]
|
||||||
|
pub use actix_cors as cors;
|
||||||
|
|
||||||
|
#[cfg(feature = "deprecated")]
|
||||||
|
#[deprecated(
|
||||||
|
since = "1.0.1",
|
||||||
|
note = "please use `actix_identity` instead. support will be removed in actix-web 1.0.2"
|
||||||
|
)]
|
||||||
|
pub use actix_identity as identity;
|
||||||
|
@ -38,7 +38,8 @@ impl ResourceMap {
|
|||||||
pub(crate) fn finish(&self, current: Rc<ResourceMap>) {
|
pub(crate) fn finish(&self, current: Rc<ResourceMap>) {
|
||||||
for (_, nested) in &self.patterns {
|
for (_, nested) in &self.patterns {
|
||||||
if let Some(ref nested) = nested {
|
if let Some(ref nested) = nested {
|
||||||
*nested.parent.borrow_mut() = Some(current.clone())
|
*nested.parent.borrow_mut() = Some(current.clone());
|
||||||
|
nested.finish(nested.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
src/scope.rs
20
src/scope.rs
@ -1135,4 +1135,24 @@ mod tests {
|
|||||||
let body = read_body(resp);
|
let body = read_body(resp);
|
||||||
assert_eq!(body, &b"https://youtube.com/watch/xxxxxx"[..]);
|
assert_eq!(body, &b"https://youtube.com/watch/xxxxxx"[..]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_url_for_nested() {
|
||||||
|
let mut srv = init_service(App::new().service(web::scope("/a").service(
|
||||||
|
web::scope("/b").service(web::resource("/c/{stuff}").name("c").route(
|
||||||
|
web::get().to(|req: HttpRequest| {
|
||||||
|
HttpResponse::Ok()
|
||||||
|
.body(format!("{}", req.url_for("c", &["12345"]).unwrap()))
|
||||||
|
}),
|
||||||
|
)),
|
||||||
|
)));
|
||||||
|
let req = TestRequest::with_uri("/a/b/c/test").to_request();
|
||||||
|
let resp = call_service(&mut srv, req);
|
||||||
|
assert_eq!(resp.status(), StatusCode::OK);
|
||||||
|
let body = read_body(resp);
|
||||||
|
assert_eq!(
|
||||||
|
body,
|
||||||
|
Bytes::from_static(b"http://localhost:8080/a/b/c/12345")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user