diff --git a/.github/workflows/ci-post-merge.yml b/.github/workflows/ci-post-merge.yml
index ff0a5fd9f..45a5f5c60 100644
--- a/.github/workflows/ci-post-merge.yml
+++ b/.github/workflows/ci-post-merge.yml
@@ -35,7 +35,7 @@ jobs:
with:
toolchain: nightly
- - uses: taiki-e/install-action@v2.20.3
+ - uses: taiki-e/install-action@v2.21.7
with:
tool: cargo-hack
@@ -77,7 +77,7 @@ jobs:
with:
toolchain: nightly
- - uses: taiki-e/install-action@v2.20.3
+ - uses: taiki-e/install-action@v2.21.7
with:
tool: cargo-hack
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8571d0532..e1b74a31f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -49,7 +49,7 @@ jobs:
toolchain: ${{ matrix.version.version }}
- name: Install cargo-hack
- uses: taiki-e/install-action@v2.20.3
+ uses: taiki-e/install-action@v2.21.7
with:
tool: cargo-hack
@@ -100,7 +100,7 @@ jobs:
toolchain: ${{ matrix.version.version }}
- name: Install cargo-hack
- uses: taiki-e/install-action@v2.20.3
+ uses: taiki-e/install-action@v2.21.7
with:
tool: cargo-hack
diff --git a/.github/workflows/upload-doc.yml b/.github/workflows/upload-doc.yml
index 3abf6d1c8..ac0ec3f94 100644
--- a/.github/workflows/upload-doc.yml
+++ b/.github/workflows/upload-doc.yml
@@ -1,9 +1,11 @@
name: Upload Documentation
on:
- push: { branches: [master] }
+ push:
+ branches: [master]
-permissions: { contents: write }
+permissions:
+ contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -18,10 +20,11 @@ jobs:
- name: Install Rust (nightly)
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
- with: { toolchain: nightly }
+ with:
+ toolchain: nightly
- name: Build Docs
- run: cargo doc --workspace --all-features --no-deps
+ run: cargo doc --no-deps --workspace --all-features
- name: Tweak HTML
run: echo '' > target/doc/index.html
@@ -29,6 +32,5 @@ jobs:
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- BRANCH: gh-pages
- FOLDER: target/doc
+ folder: target/doc
+ branch: gh-pages
diff --git a/Cargo.toml b/Cargo.toml
index 645d4f39d..4793d4ee6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ members = [
"actix-session",
"actix-settings",
"actix-web-httpauth",
+ "actix-ws",
]
[workspace.package]
diff --git a/LICENSE-APACHE b/LICENSE-APACHE
index d0eb30d70..fb96878c0 100644
--- a/LICENSE-APACHE
+++ b/LICENSE-APACHE
@@ -186,8 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2017-NOW Nikolay Kim
- Copyright 2017-NOW svartalf and Actix team
+ Copyright 2017-NOW Actix team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/LICENSE-MIT b/LICENSE-MIT
index e57de3745..255963b91 100644
--- a/LICENSE-MIT
+++ b/LICENSE-MIT
@@ -1,5 +1,4 @@
-Copyright (c) 2017 Nikolay Kim
-Copyright (c) 2017 svartalf and Actix team
+Copyright (c) 2023 Actix team
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
diff --git a/README.md b/README.md
index b2c830bfd..a6d55decd 100644
--- a/README.md
+++ b/README.md
@@ -9,16 +9,17 @@
## Crates by @actix
-| Crate | | |
-| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
-| [actix-cors] | [](https://crates.io/crates/actix-cors) [](https://deps.rs/crate/actix-cors/0.6.4) | Cross-Origin Resource Sharing (CORS) controls. |
-| [actix-identity] | [](https://crates.io/crates/actix-identity) [](https://deps.rs/crate/actix-identity/0.6.0) | Identity management. |
-| [actix-limitation] | [](https://crates.io/crates/actix-limitation) [](https://deps.rs/crate/actix-limitation/0.5.1) | Rate-limiting using a fixed window counter for arbitrary keys, backed by Redis. |
-| [actix-protobuf] | [](https://crates.io/crates/actix-protobuf) [](https://deps.rs/crate/actix-protobuf/0.10.0) | Protobuf payload extractor. |
-| [actix-redis] | [](https://crates.io/crates/actix-redis) [](https://deps.rs/crate/actix-redis/0.13.0) | Actor-based Redis client. |
-| [actix-session] | [](https://crates.io/crates/actix-session) [](https://deps.rs/crate/actix-session/0.8.0) | Session management. |
-| [actix-settings] | [](https://crates.io/crates/actix-settings) [](https://deps.rs/crate/actix-settings/0.6.0) | Easily manage Actix Web's settings from a TOML file and environment variables. |
-| [actix-web-httpauth] | [](https://crates.io/crates/actix-web-httpauth) [](https://deps.rs/crate/actix-web-httpauth/0.8.1) | HTTP authentication schemes. |
+| Crate | | |
+| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
+| [actix-cors] | [](https://crates.io/crates/actix-cors) [](https://deps.rs/crate/actix-cors) | Cross-Origin Resource Sharing (CORS) controls. |
+| [actix-identity] | [](https://crates.io/crates/actix-identity) [](https://deps.rs/crate/actix-identity) | Identity management. |
+| [actix-limitation] | [](https://crates.io/crates/actix-limitation) [](https://deps.rs/crate/actix-limitation) | Rate-limiting using a fixed window counter for arbitrary keys, backed by Redis. |
+| [actix-protobuf] | [](https://crates.io/crates/actix-protobuf) [](https://deps.rs/crate/actix-protobuf) | Protobuf payload extractor. |
+| [actix-redis] | [](https://crates.io/crates/actix-redis) [](https://deps.rs/crate/actix-redis) | Actor-based Redis client. |
+| [actix-session] | [](https://crates.io/crates/actix-session) [](https://deps.rs/crate/actix-session) | Session management. |
+| [actix-settings] | [](https://crates.io/crates/actix-settings) [](https://deps.rs/crate/actix-settings) | Easily manage Actix Web's settings from a TOML file and environment variables. |
+| [actix-web-httpauth] | [](https://crates.io/crates/actix-web-httpauth) [](https://deps.rs/crate/actix-web-httpauth) | HTTP authentication schemes. |
+| [actix-ws] | [][actix-ws] [](https://deps.rs/crate/actix-ws) | WebSockets for Actix Web, without actors. |
---
@@ -26,24 +27,23 @@
These crates are provided by the community.
-| Crate | | |
-| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
-| [actix-web-lab] | [][actix-web-lab] [](https://deps.rs/crate/actix-web-lab/0.19.1) | Experimental extractors, middleware, and other extras for possible inclusion in Actix Web. |
-| [actix-multipart-extract] | [][actix-multipart-extract] [](https://deps.rs/crate/actix-multipart-extract/0.1.5) | Better multipart form support for Actix Web. |
-| [actix-form-data] | [][actix-form-data] [](https://deps.rs/crate/actix-form-data/0.7.0-beta.4) | Multipart form data from actix multipart streams |
-| [actix-governor] | [][actix-governor] [](https://deps.rs/crate/actix-governor/0.5.1) | Rate-limiting backed by governor. |
-| [actix-casbin] | [][actix-casbin] [](https://deps.rs/crate/actix-casbin/0.4.2) | Authorization library that supports access control models like ACL, RBAC & ABAC. |
-| [actix-ip-filter] | [][actix-ip-filter] [](https://deps.rs/crate/actix-ip-filter/0.3.1) | IP address filter. Supports glob patterns. |
-| [actix-web-static-files] | [][actix-web-static-files] [](https://deps.rs/crate/actix-web-static-files/4.0.1) | Static files as embedded resources. |
-| [actix-web-grants] | [][actix-web-grants] [](https://deps.rs/crate/actix-web-grants/3.0.2) | Extension for validating user authorities. |
-| [aliri_actix] | [][aliri_actix] [](https://deps.rs/crate/aliri_actix/0.9.0) | Endpoint authorization and authentication using scoped OAuth2 JWT tokens. |
-| [actix-web-flash-messages] | [][actix-web-flash-messages] [](https://deps.rs/crate/actix-web-flash-messages/0.4.2) | Support for flash messages/one-time notifications in `actix-web`. |
-| [awmp] | [][awmp] [](https://deps.rs/crate/awmp/0.8.1) | An easy to use wrapper around multipart fields for Actix Web. |
-| [tracing-actix-web] | [][tracing-actix-web] [](https://deps.rs/crate/tracing-actix-web/0.7.6) | A middleware to collect telemetry data from applications built on top of the Actix Web framework. |
-| [actix-ws] | [][actix-ws] [](https://deps.rs/crate/actix-ws/0.2.5) | Actor-less WebSockets for the Actix Runtime. |
-| [actix-hash] | [][actix-hash] [](https://deps.rs/crate/actix-hash/0.5.0) | Hashing utilities for Actix Web. |
-| [actix-bincode] |  [](https://deps.rs/crate/actix-bincode/0.2.2) | Bincode payload extractor for Actix Web |
-| [sentinel-actix] |  [](https://deps.rs/crate/sentinel-actix/0.1.0) | General and flexible protection for Actix Web |
+| Crate | | |
+| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| [actix-web-lab] | [][actix-web-lab] [](https://deps.rs/crate/actix-web-lab) | Experimental extractors, middleware, and other extras for possible inclusion in Actix Web. |
+| [actix-multipart-extract] | [][actix-multipart-extract] [](https://deps.rs/crate/actix-multipart-extract) | Better multipart form support for Actix Web. |
+| [actix-form-data] | [][actix-form-data] [](https://deps.rs/crate/actix-form-data) | Multipart form data from actix multipart streams |
+| [actix-governor] | [][actix-governor] [](https://deps.rs/crate/actix-governor) | Rate-limiting backed by governor. |
+| [actix-casbin] | [][actix-casbin] [](https://deps.rs/crate/actix-casbin) | Authorization library that supports access control models like ACL, RBAC & ABAC. |
+| [actix-ip-filter] | [][actix-ip-filter] [](https://deps.rs/crate/actix-ip-filter) | IP address filter. Supports glob patterns. |
+| [actix-web-static-files] | [][actix-web-static-files] [](https://deps.rs/crate/actix-web-static-files) | Static files as embedded resources. |
+| [actix-web-grants] | [][actix-web-grants] [](https://deps.rs/crate/actix-web-grants) | Extension for validating user authorities. |
+| [aliri_actix] | [][aliri_actix] [](https://deps.rs/crate/aliri_actix) | Endpoint authorization and authentication using scoped OAuth2 JWT tokens. |
+| [actix-web-flash-messages] | [][actix-web-flash-messages] [](https://deps.rs/crate/actix-web-flash-messages) | Support for flash messages/one-time notifications in `actix-web`. |
+| [awmp] | [][awmp] [](https://deps.rs/crate/awmp) | An easy to use wrapper around multipart fields for Actix Web. |
+| [tracing-actix-web] | [][tracing-actix-web] [](https://deps.rs/crate/tracing-actix-web) | A middleware to collect telemetry data from applications built on top of the Actix Web framework. |
+| [actix-hash] | [][actix-hash] [](https://deps.rs/crate/actix-hash) | Hashing utilities for Actix Web. |
+| [actix-bincode] |  [](https://deps.rs/crate/actix-bincode) | Bincode payload extractor for Actix Web |
+| [sentinel-actix] |  [](https://deps.rs/crate/sentinel-actix) | General and flexible protection for Actix Web |
To add a crate to this list, submit a pull request.
diff --git a/actix-cors/src/builder.rs b/actix-cors/src/builder.rs
index 51c89223c..a71a9255d 100644
--- a/actix-cors/src/builder.rs
+++ b/actix-cors/src/builder.rs
@@ -52,13 +52,20 @@ static ALL_METHODS_SET: Lazy> = Lazy::new(|| {
/// The alternative [`Cors::permissive()`] constructor is available for local development, allowing
/// all origins and headers, etc. **The permissive constructor should not be used in production.**
///
+/// # Behavior
+///
+/// In all cases, behavior for this crate follows the [Fetch Standard CORS protocol]. See that
+/// document for information on exact semantics for configuration options and combinations.
+///
/// # Errors
+///
/// Errors surface in the middleware initialization phase. This means that, if you have logs enabled
/// in Actix Web (using `env_logger` or other crate that exposes logs from the `log` crate), error
/// messages will outline what is wrong with the CORS configuration in the server logs and the
/// server will fail to start up or serve requests.
///
/// # Example
+///
/// ```
/// use actix_cors::Cors;
/// use actix_web::http::header;
@@ -72,6 +79,8 @@ static ALL_METHODS_SET: Lazy> = Lazy::new(|| {
///
/// // `cors` can now be used in `App::wrap`.
/// ```
+///
+/// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol
#[derive(Debug)]
pub struct Cors {
inner: Rc,
@@ -79,7 +88,8 @@ pub struct Cors {
}
impl Cors {
- /// A very permissive set of default for quick development. Not recommended for production use.
+ /// Constructs a very permissive set of defaults for quick development. (Not recommended for
+ /// production use.)
///
/// *All* origins, methods, request headers and exposed headers allowed. Credentials supported.
/// Max age 1 hour. Does not send wildcard.
@@ -124,7 +134,7 @@ impl Cors {
self
}
- /// Add an origin that is allowed to make requests.
+ /// Adds an origin that is allowed to make requests.
///
/// This method allows specifying a finite set of origins to verify the value of the `Origin`
/// request header. These are `origin-or-null` types in the [Fetch Standard].
@@ -177,7 +187,7 @@ impl Cors {
self
}
- /// Determinate allowed origins by processing requests which didn't match any origins specified
+ /// Determinates allowed origins by processing requests which didn't match any origins specified
/// in the `allowed_origin`.
///
/// The function will receive two parameters, the Origin header value, and the `RequestHead` of
@@ -209,14 +219,11 @@ impl Cors {
self
}
- /// Set a list of methods which allowed origins can perform.
+ /// Sets a list of methods which allowed origins can perform.
///
- /// These will be sent in the `Access-Control-Allow-Methods` response header as specified in
- /// the [Fetch Standard CORS protocol].
+ /// These will be sent in the `Access-Control-Allow-Methods` response header.
///
/// This defaults to an empty set.
- ///
- /// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol
pub fn allowed_methods(mut self, methods: U) -> Cors
where
U: IntoIterator,
@@ -279,16 +286,13 @@ impl Cors {
self
}
- /// Set a list of request header field names which can be used when this resource is accessed by
- /// allowed origins.
+ /// Sets a list of request header field names which can be used when this resource is accessed
+ /// by allowed origins.
///
/// If `All` is set, whatever is requested by the client in `Access-Control-Request-Headers`
- /// will be echoed back in the `Access-Control-Allow-Headers` header as specified in
- /// the [Fetch Standard CORS protocol].
+ /// will be echoed back in the `Access-Control-Allow-Headers` header.
///
/// This defaults to an empty set.
- ///
- /// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol
pub fn allowed_headers(mut self, headers: U) -> Cors
where
U: IntoIterator,
@@ -329,13 +333,11 @@ impl Cors {
self
}
- /// Set a list of headers which are safe to expose to the API of a CORS API specification.
- /// This corresponds to the `Access-Control-Expose-Headers` response header as specified in
- /// the [Fetch Standard CORS protocol].
+ /// Sets a list of headers which are safe to expose to the API of a CORS API specification.
+ ///
+ /// This corresponds to the `Access-Control-Expose-Headers` response header.
///
/// This defaults to an empty set.
- ///
- /// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol
pub fn expose_headers(mut self, headers: U) -> Cors
where
U: IntoIterator,
@@ -364,12 +366,11 @@ impl Cors {
self
}
- /// Set a maximum time (in seconds) for which this CORS request may be cached. This value is set
- /// as the `Access-Control-Max-Age` header as specified in the [Fetch Standard CORS protocol].
+ /// Sets a maximum time (in seconds) for which this CORS request may be cached.
+ ///
+ /// This value is set as the `Access-Control-Max-Age` header.
///
/// Pass a number (of seconds) or use None to disable sending max age header.
- ///
- /// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol
pub fn max_age(mut self, max_age: impl Into