1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-06 19:00:18 +02:00

Compare commits

...

9 Commits

Author SHA1 Message Date
ad0e6f73b3 update version 2019-06-17 12:35:00 +06:00
546a8a58db remove cors and identity middlewares 2019-06-17 12:33:00 +06:00
acda1c075a prepare actix-web release 2019-06-17 12:23:30 +06:00
686e5f1595 update deps 2019-06-16 22:10:22 +06:00
d2b6502c7a prepare actix-http release 2019-06-16 21:59:22 +06:00
7c0f570845 Do not compress NoContent (204) responses #918 2019-06-16 21:54:17 +06:00
eaa371db8b update migration 2019-06-15 22:20:46 +06:00
d293ae2a69 fix nested resource map registration #915 2019-06-15 22:12:20 +06:00
d7ec241fd0 re-export identity and cors middleware 2019-06-15 21:47:06 +06:00
19 changed files with 98 additions and 50 deletions

View File

@ -1,6 +1,15 @@
# Changes # Changes
## [1.0.1] - 2019-06-xx ## [1.0.2] - 2019-06-17
### Changes
* Move cors middleware to `actix-cors` crate.
* Move identity middleware to `actix-identity` crate.
## [1.0.1] - 2019-06-17
### Add ### Add
@ -20,6 +29,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

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-web" name = "actix-web"
version = "1.0.0" version = "1.0.2"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust." description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
readme = "README.md" readme = "README.md"
@ -70,24 +70,22 @@ rust-tls = ["rustls", "actix-server/rust-tls"]
[dependencies] [dependencies]
actix-codec = "0.1.2" actix-codec = "0.1.2"
actix-service = "0.4.0" actix-service = "0.4.1"
actix-utils = "0.4.1" actix-utils = "0.4.1"
actix-router = "0.1.5" actix-router = "0.1.5"
actix-rt = "0.2.2" actix-rt = "0.2.2"
actix-web-codegen = "0.1.2" actix-web-codegen = "0.1.2"
actix-http = "0.2.3" actix-http = "0.2.4"
actix-server = "0.5.1" actix-server = "0.5.1"
actix-server-config = "0.1.1" 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" }
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 +102,9 @@ openssl = { version="0.10", optional = true }
rustls = { version = "0.15", optional = true } rustls = { version = "0.15", optional = true }
[dev-dependencies] [dev-dependencies]
actix-http = { version = "0.2.3", features=["ssl", "brotli", "flate2-zlib"] }
actix-http-test = { version = "0.2.0", features=["ssl"] }
actix-files = "0.1.1"
actix = { version = "0.8.3" } actix = { version = "0.8.3" }
actix-http = { version = "0.2.4", features=["ssl", "brotli", "flate2-zlib"] }
actix-http-test = { version = "0.2.2", features=["ssl"] }
rand = "0.6" rand = "0.6"
env_logger = "0.6" env_logger = "0.6"
serde_derive = "1.0" serde_derive = "1.0"

View File

@ -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

View File

@ -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"

View File

@ -19,12 +19,12 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = { version = "1.0.0", default-features = false } actix-web = { version = "1.0.0", default-features = false }
actix-http = "0.2.3" actix-http = "0.2.4"
actix-service = "0.4.0" actix-service = "0.4.1"
bitflags = "1" bitflags = "1"
bytes = "0.4" bytes = "0.4"
futures = "0.1.25" futures = "0.1.25"
derive_more = "0.14" derive_more = "0.15.0"
log = "0.4" log = "0.4"
mime = "0.3" mime = "0.3"
mime_guess = "2.0.0-alpha" mime_guess = "2.0.0-alpha"

View File

@ -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

View File

@ -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"

View File

@ -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);

View File

@ -19,9 +19,9 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = { version = "1.0.0", default-features = false } actix-web = { version = "1.0.0", default-features = false }
actix-service = "0.4.0" actix-service = "0.4.1"
bytes = "0.4" bytes = "0.4"
derive_more = "0.14" derive_more = "0.15.0"
httparse = "1.3" httparse = "1.3"
futures = "0.1.25" futures = "0.1.25"
log = "0.4" log = "0.4"
@ -31,4 +31,4 @@ twoway = "0.2"
[dev-dependencies] [dev-dependencies]
actix-rt = "0.2.2" actix-rt = "0.2.2"
actix-http = "0.2.2" actix-http = "0.2.4"

View File

@ -24,12 +24,12 @@ default = ["cookie-session"]
cookie-session = ["actix-web/secure-cookies"] cookie-session = ["actix-web/secure-cookies"]
[dependencies] [dependencies]
actix-web = "1.0.0-rc" actix-web = "1.0.0"
actix-service = "0.4.0" actix-service = "0.4.1"
bytes = "0.4" bytes = "0.4"
derive_more = "0.14" derive_more = "0.15.0"
futures = "0.1.25" futures = "0.1.25"
hashbrown = "0.3.0" hashbrown = "0.5.0"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
time = "0.1.42" time = "0.1.42"

View File

@ -19,8 +19,8 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix = "0.8.3" actix = "0.8.3"
actix-web = "1.0.0-rc" actix-web = "1.0.0"
actix-http = "0.2.2" actix-http = "0.2.4"
actix-codec = "0.1.2" actix-codec = "0.1.2"
bytes = "0.4" bytes = "0.4"
futures = "0.1.25" futures = "0.1.25"

View File

@ -16,7 +16,7 @@ quote = "0.6.12"
syn = { version = "0.15.34", features = ["full", "parsing", "extra-traits"] } syn = { version = "0.15.34", features = ["full", "parsing", "extra-traits"] }
[dev-dependencies] [dev-dependencies]
actix-web = { version = "1.0.0-rc" } actix-web = { version = "1.0.0" }
actix-http = { version = "0.2.2", features=["ssl"] } actix-http = { version = "0.2.4", features=["ssl"] }
actix-http-test = { version = "0.2.0", features=["ssl"] } actix-http-test = { version = "0.2.0", features=["ssl"] }
futures = { version = "0.1" } futures = { version = "0.1" }

View File

@ -40,11 +40,11 @@ flate2-rust = ["actix-http/flate2-rust"]
[dependencies] [dependencies]
actix-codec = "0.1.2" actix-codec = "0.1.2"
actix-service = "0.4.0" actix-service = "0.4.1"
actix-http = "0.2.3" actix-http = "0.2.4"
base64 = "0.10.1" base64 = "0.10.1"
bytes = "0.4" bytes = "0.4"
derive_more = "0.14" derive_more = "0.15.0"
futures = "0.1.25" futures = "0.1.25"
log =" 0.4" log =" 0.4"
mime = "0.3" mime = "0.3"
@ -58,8 +58,8 @@ openssl = { version="0.10", optional = true }
[dev-dependencies] [dev-dependencies]
actix-rt = "0.2.2" actix-rt = "0.2.2"
actix-web = { version = "1.0.0-rc", features=["ssl"] } actix-web = { version = "1.0.0", features=["ssl"] }
actix-http = { version = "0.2.3", features=["ssl"] } actix-http = { version = "0.2.4", features=["ssl"] }
actix-http-test = { version = "0.2.0", features=["ssl"] } actix-http-test = { version = "0.2.0", features=["ssl"] }
actix-utils = "0.4.1" actix-utils = "0.4.1"
actix-server = { version = "0.5.1", features=["ssl"] } actix-server = { version = "0.5.1", features=["ssl"] }

View File

@ -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())
/// ); /// );
/// } /// }
/// ``` /// ```

View File

@ -10,6 +10,3 @@ mod normalize;
pub use self::defaultheaders::DefaultHeaders; 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;
//
// use actix_cors as cors;

View File

@ -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());
} }
} }
} }

View File

@ -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")
);
}
} }

View File

@ -1,5 +1,9 @@
# Changes # Changes
## [0.2.2] - 2019-06-16
* Add .put() and .sput() methods
## [0.2.1] - 2019-06-05 ## [0.2.1] - 2019-06-05
* Add license files * Add license files

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-http-test" name = "actix-http-test"
version = "0.2.1" version = "0.2.2"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix http test server" description = "Actix http test server"
readme = "README.md" readme = "README.md"
@ -32,7 +32,7 @@ ssl = ["openssl", "actix-server/ssl", "awc/ssl"]
[dependencies] [dependencies]
actix-codec = "0.1.2" actix-codec = "0.1.2"
actix-rt = "0.2.2" actix-rt = "0.2.2"
actix-service = "0.4.0" actix-service = "0.4.1"
actix-server = "0.5.1" actix-server = "0.5.1"
actix-utils = "0.4.1" actix-utils = "0.4.1"
awc = "0.2.1" awc = "0.2.1"
@ -55,5 +55,5 @@ tokio-timer = "0.2"
openssl = { version="0.10", optional = true } openssl = { version="0.10", optional = true }
[dev-dependencies] [dev-dependencies]
actix-web = "1.0.0-rc" actix-web = "1.0.0"
actix-http = "0.2.3" actix-http = "0.2.4"