mirror of
https://github.com/tokio-rs/axum.git
synced 2025-09-30 06:21:07 +00:00
Use new Cargo features to avoid implicit features for optional dependencies (#1239)
* Fix changelog entry for MSRV change in axum-extra 0.3.5 * Bump MSRV to 1.60 for axum, axum-extra, axum-macros * Use new Cargo features to avoid implicit features for optional dependencies
This commit is contained in:
parent
d9ef24c5ff
commit
7cbb7cf135
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
@ -2,7 +2,7 @@ name: CI
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
MSRV: 1.56
|
MSRV: '1.60'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -12,13 +12,15 @@ and this project adheres to [Semantic Versioning].
|
|||||||
- **changed:** For methods that accept some `S: Service`, the bounds have been
|
- **changed:** For methods that accept some `S: Service`, the bounds have been
|
||||||
relaxed so the response type must implement `IntoResponse` rather than being a
|
relaxed so the response type must implement `IntoResponse` rather than being a
|
||||||
literal `Response`
|
literal `Response`
|
||||||
|
- **change:** axum-extra's MSRV is now 1.60 ([#1239])
|
||||||
|
|
||||||
[#1119]: https://github.com/tokio-rs/axum/pull/1119
|
[#1119]: https://github.com/tokio-rs/axum/pull/1119
|
||||||
|
[#1239]: https://github.com/tokio-rs/axum/pull/1239
|
||||||
|
|
||||||
# 0.3.5 (27. June, 2022)
|
# 0.3.5 (27. June, 2022)
|
||||||
|
|
||||||
- **added:** Add `JsonLines` for streaming newline delimited JSON ([#1093])
|
- **added:** Add `JsonLines` for streaming newline delimited JSON ([#1093])
|
||||||
- **change:** axum's MSRV is now 1.56 ([#1098])
|
- **change:** axum-extra's MSRV is now 1.56 ([#1098])
|
||||||
|
|
||||||
[#1093]: https://github.com/tokio-rs/axum/pull/1093
|
[#1093]: https://github.com/tokio-rs/axum/pull/1093
|
||||||
[#1098]: https://github.com/tokio-rs/axum/pull/1098
|
[#1098]: https://github.com/tokio-rs/axum/pull/1098
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
categories = ["asynchronous", "network-programming", "web-programming"]
|
categories = ["asynchronous", "network-programming", "web-programming"]
|
||||||
description = "Extra utilities for axum"
|
description = "Extra utilities for axum"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56"
|
rust-version = "1.60"
|
||||||
homepage = "https://github.com/tokio-rs/axum"
|
homepage = "https://github.com/tokio-rs/axum"
|
||||||
keywords = ["http", "web", "framework"]
|
keywords = ["http", "web", "framework"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -14,16 +14,23 @@ version = "0.3.5"
|
|||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
async-read-body = ["tokio-util/io"]
|
async-read-body = ["dep:tokio-util", "tokio-util?/io"]
|
||||||
cookie = ["cookie-lib"]
|
cookie = ["dep:cookie"]
|
||||||
cookie-private = ["cookie", "cookie-lib/private"]
|
cookie-private = ["cookie", "cookie?/private"]
|
||||||
cookie-signed = ["cookie", "cookie-lib/signed"]
|
cookie-signed = ["cookie", "cookie?/signed"]
|
||||||
erased-json = ["serde_json", "serde"]
|
erased-json = ["dep:serde_json", "dep:serde"]
|
||||||
form = ["serde", "serde_html_form"]
|
form = ["dep:serde", "dep:serde_html_form"]
|
||||||
json-lines = ["serde_json", "serde", "tokio-util/io", "tokio-stream/io-util"]
|
json-lines = [
|
||||||
query = ["serde", "serde_html_form"]
|
"dep:serde_json",
|
||||||
|
"dep:serde",
|
||||||
|
"dep:tokio-util",
|
||||||
|
"dep:tokio-stream",
|
||||||
|
"tokio-util?/io",
|
||||||
|
"tokio-stream?/io-util"
|
||||||
|
]
|
||||||
|
query = ["dep:serde", "dep:serde_html_form"]
|
||||||
spa = ["tower-http/fs"]
|
spa = ["tower-http/fs"]
|
||||||
typed-routing = ["axum-macros", "serde", "percent-encoding"]
|
typed-routing = ["dep:axum-macros", "dep:serde", "dep:percent-encoding"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = { path = "../axum", version = "0.5", default-features = false }
|
axum = { path = "../axum", version = "0.5", default-features = false }
|
||||||
@ -40,7 +47,7 @@ tower-service = "0.3"
|
|||||||
|
|
||||||
# optional dependencies
|
# optional dependencies
|
||||||
axum-macros = { path = "../axum-macros", version = "0.2.2", optional = true }
|
axum-macros = { path = "../axum-macros", version = "0.2.2", optional = true }
|
||||||
cookie-lib = { package = "cookie", version = "0.16", features = ["percent-encode"], optional = true }
|
cookie = { package = "cookie", version = "0.16", features = ["percent-encode"], optional = true }
|
||||||
percent-encoding = { version = "2.1", optional = true }
|
percent-encoding = { version = "2.1", optional = true }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
serde_html_form = { version = "0.1", optional = true }
|
serde_html_form = { version = "0.1", optional = true }
|
||||||
|
@ -14,7 +14,7 @@ This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in
|
|||||||
|
|
||||||
## Minimum supported Rust version
|
## Minimum supported Rust version
|
||||||
|
|
||||||
axum-extra's MSRV is 1.56.
|
axum-extra's MSRV is 1.60.
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ pub use self::private::PrivateCookieJar;
|
|||||||
#[cfg(feature = "cookie-signed")]
|
#[cfg(feature = "cookie-signed")]
|
||||||
pub use self::signed::SignedCookieJar;
|
pub use self::signed::SignedCookieJar;
|
||||||
|
|
||||||
pub use cookie_lib::{Cookie, Expiration, SameSite};
|
pub use cookie::{Cookie, Expiration, SameSite};
|
||||||
|
|
||||||
#[cfg(any(feature = "cookie-signed", feature = "cookie-private"))]
|
#[cfg(any(feature = "cookie-signed", feature = "cookie-private"))]
|
||||||
pub use cookie_lib::Key;
|
pub use cookie::Key;
|
||||||
|
|
||||||
/// Extractor that grabs cookies from the request and manages the jar.
|
/// Extractor that grabs cookies from the request and manages the jar.
|
||||||
///
|
///
|
||||||
@ -84,7 +84,7 @@ pub use cookie_lib::Key;
|
|||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CookieJar {
|
pub struct CookieJar {
|
||||||
jar: cookie_lib::CookieJar,
|
jar: cookie::CookieJar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -95,7 +95,7 @@ where
|
|||||||
type Rejection = Infallible;
|
type Rejection = Infallible;
|
||||||
|
|
||||||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
||||||
let mut jar = cookie_lib::CookieJar::new();
|
let mut jar = cookie::CookieJar::new();
|
||||||
for cookie in cookies_from_request(req) {
|
for cookie in cookies_from_request(req) {
|
||||||
jar.add_original(cookie);
|
jar.add_original(cookie);
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ impl IntoResponse for CookieJar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_cookies(jar: cookie_lib::CookieJar, headers: &mut HeaderMap) {
|
fn set_cookies(jar: cookie::CookieJar, headers: &mut HeaderMap) {
|
||||||
for cookie in jar.delta() {
|
for cookie in jar.delta() {
|
||||||
if let Ok(header_value) = cookie.encoded().to_string().parse() {
|
if let Ok(header_value) = cookie.encoded().to_string().parse() {
|
||||||
headers.append(SET_COOKIE, header_value);
|
headers.append(SET_COOKIE, header_value);
|
||||||
|
@ -5,7 +5,7 @@ use axum::{
|
|||||||
response::{IntoResponse, IntoResponseParts, Response, ResponseParts},
|
response::{IntoResponse, IntoResponseParts, Response, ResponseParts},
|
||||||
Extension,
|
Extension,
|
||||||
};
|
};
|
||||||
use cookie_lib::PrivateJar;
|
use cookie::PrivateJar;
|
||||||
use std::{convert::Infallible, fmt, marker::PhantomData};
|
use std::{convert::Infallible, fmt, marker::PhantomData};
|
||||||
|
|
||||||
/// Extractor that grabs private cookies from the request and manages the jar.
|
/// Extractor that grabs private cookies from the request and manages the jar.
|
||||||
@ -57,7 +57,7 @@ use std::{convert::Infallible, fmt, marker::PhantomData};
|
|||||||
/// # let app: Router<axum::body::Body> = app;
|
/// # let app: Router<axum::body::Body> = app;
|
||||||
/// ```
|
/// ```
|
||||||
pub struct PrivateCookieJar<K = Key> {
|
pub struct PrivateCookieJar<K = Key> {
|
||||||
jar: cookie_lib::CookieJar,
|
jar: cookie::CookieJar,
|
||||||
key: Key,
|
key: Key,
|
||||||
// The key used to extract the key extension. Allows users to use multiple keys for different
|
// The key used to extract the key extension. Allows users to use multiple keys for different
|
||||||
// jars. Maybe a library wants its own key.
|
// jars. Maybe a library wants its own key.
|
||||||
@ -84,7 +84,7 @@ where
|
|||||||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
||||||
let key = Extension::<K>::from_request(req).await?.0.into();
|
let key = Extension::<K>::from_request(req).await?.0.into();
|
||||||
|
|
||||||
let mut jar = cookie_lib::CookieJar::new();
|
let mut jar = cookie::CookieJar::new();
|
||||||
let mut private_jar = jar.private_mut(&key);
|
let mut private_jar = jar.private_mut(&key);
|
||||||
for cookie in cookies_from_request(req) {
|
for cookie in cookies_from_request(req) {
|
||||||
if let Some(cookie) = private_jar.decrypt(cookie) {
|
if let Some(cookie) = private_jar.decrypt(cookie) {
|
||||||
@ -176,11 +176,11 @@ impl<K> PrivateCookieJar<K> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn private_jar(&self) -> PrivateJar<&'_ cookie_lib::CookieJar> {
|
fn private_jar(&self) -> PrivateJar<&'_ cookie::CookieJar> {
|
||||||
self.jar.private(&self.key)
|
self.jar.private(&self.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn private_jar_mut(&mut self) -> PrivateJar<&'_ mut cookie_lib::CookieJar> {
|
fn private_jar_mut(&mut self) -> PrivateJar<&'_ mut cookie::CookieJar> {
|
||||||
self.jar.private_mut(&self.key)
|
self.jar.private_mut(&self.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ impl<K> IntoResponse for PrivateCookieJar<K> {
|
|||||||
|
|
||||||
struct PrivateCookieJarIter<'a, K> {
|
struct PrivateCookieJarIter<'a, K> {
|
||||||
jar: &'a PrivateCookieJar<K>,
|
jar: &'a PrivateCookieJar<K>,
|
||||||
iter: cookie_lib::Iter<'a>,
|
iter: cookie::Iter<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K> Iterator for PrivateCookieJarIter<'a, K> {
|
impl<'a, K> Iterator for PrivateCookieJarIter<'a, K> {
|
||||||
|
@ -5,8 +5,8 @@ use axum::{
|
|||||||
response::{IntoResponse, IntoResponseParts, Response, ResponseParts},
|
response::{IntoResponse, IntoResponseParts, Response, ResponseParts},
|
||||||
Extension,
|
Extension,
|
||||||
};
|
};
|
||||||
use cookie_lib::SignedJar;
|
use cookie::SignedJar;
|
||||||
use cookie_lib::{Cookie, Key};
|
use cookie::{Cookie, Key};
|
||||||
use std::{convert::Infallible, fmt, marker::PhantomData};
|
use std::{convert::Infallible, fmt, marker::PhantomData};
|
||||||
|
|
||||||
/// Extractor that grabs signed cookies from the request and manages the jar.
|
/// Extractor that grabs signed cookies from the request and manages the jar.
|
||||||
@ -75,7 +75,7 @@ use std::{convert::Infallible, fmt, marker::PhantomData};
|
|||||||
/// # let app: Router<axum::body::Body> = app;
|
/// # let app: Router<axum::body::Body> = app;
|
||||||
/// ```
|
/// ```
|
||||||
pub struct SignedCookieJar<K = Key> {
|
pub struct SignedCookieJar<K = Key> {
|
||||||
jar: cookie_lib::CookieJar,
|
jar: cookie::CookieJar,
|
||||||
key: Key,
|
key: Key,
|
||||||
// The key used to extract the key extension. Allows users to use multiple keys for different
|
// The key used to extract the key extension. Allows users to use multiple keys for different
|
||||||
// jars. Maybe a library wants its own key.
|
// jars. Maybe a library wants its own key.
|
||||||
@ -102,7 +102,7 @@ where
|
|||||||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
||||||
let key = Extension::<K>::from_request(req).await?.0.into();
|
let key = Extension::<K>::from_request(req).await?.0.into();
|
||||||
|
|
||||||
let mut jar = cookie_lib::CookieJar::new();
|
let mut jar = cookie::CookieJar::new();
|
||||||
let mut signed_jar = jar.signed_mut(&key);
|
let mut signed_jar = jar.signed_mut(&key);
|
||||||
for cookie in cookies_from_request(req) {
|
for cookie in cookies_from_request(req) {
|
||||||
if let Some(cookie) = signed_jar.verify(cookie) {
|
if let Some(cookie) = signed_jar.verify(cookie) {
|
||||||
@ -195,11 +195,11 @@ impl<K> SignedCookieJar<K> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signed_jar(&self) -> SignedJar<&'_ cookie_lib::CookieJar> {
|
fn signed_jar(&self) -> SignedJar<&'_ cookie::CookieJar> {
|
||||||
self.jar.signed(&self.key)
|
self.jar.signed(&self.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signed_jar_mut(&mut self) -> SignedJar<&'_ mut cookie_lib::CookieJar> {
|
fn signed_jar_mut(&mut self) -> SignedJar<&'_ mut cookie::CookieJar> {
|
||||||
self.jar.signed_mut(&self.key)
|
self.jar.signed_mut(&self.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ impl<K> IntoResponse for SignedCookieJar<K> {
|
|||||||
|
|
||||||
struct SignedCookieJarIter<'a, K> {
|
struct SignedCookieJarIter<'a, K> {
|
||||||
jar: &'a SignedCookieJar<K>,
|
jar: &'a SignedCookieJar<K>,
|
||||||
iter: cookie_lib::Iter<'a>,
|
iter: cookie::Iter<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K> Iterator for SignedCookieJarIter<'a, K> {
|
impl<'a, K> Iterator for SignedCookieJarIter<'a, K> {
|
||||||
|
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
- None.
|
- **change:** axum-macro's MSRV is now 1.60 ([#1239])
|
||||||
|
|
||||||
|
[#1239]: https://github.com/tokio-rs/axum/pull/1239
|
||||||
|
|
||||||
# 0.2.3 (27. June, 2022)
|
# 0.2.3 (27. June, 2022)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
categories = ["asynchronous", "network-programming", "web-programming"]
|
categories = ["asynchronous", "network-programming", "web-programming"]
|
||||||
description = "Macros for axum"
|
description = "Macros for axum"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56"
|
rust-version = "1.60"
|
||||||
homepage = "https://github.com/tokio-rs/axum"
|
homepage = "https://github.com/tokio-rs/axum"
|
||||||
keywords = ["axum"]
|
keywords = ["axum"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -14,7 +14,7 @@ This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in
|
|||||||
|
|
||||||
## Minimum supported Rust version
|
## Minimum supported Rust version
|
||||||
|
|
||||||
axum-macros's MSRV is 1.56.
|
axum-macros's MSRV is 1.60.
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- **changed:** For methods that accept some `S: Service`, the bounds have been
|
- **changed:** For methods that accept some `S: Service`, the bounds have been
|
||||||
relaxed so the response type must implement `IntoResponse` rather than being a
|
relaxed so the response type must implement `IntoResponse` rather than being a
|
||||||
literal `Response`
|
literal `Response`
|
||||||
|
- **change:** axum's MSRV is now 1.60 ([#1239])
|
||||||
|
|
||||||
[#1171]: https://github.com/tokio-rs/axum/pull/1171
|
[#1171]: https://github.com/tokio-rs/axum/pull/1171
|
||||||
[#1077]: https://github.com/tokio-rs/axum/pull/1077
|
[#1077]: https://github.com/tokio-rs/axum/pull/1077
|
||||||
@ -41,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
[#1130]: https://github.com/tokio-rs/axum/pull/1130
|
[#1130]: https://github.com/tokio-rs/axum/pull/1130
|
||||||
[#1135]: https://github.com/tokio-rs/axum/pull/1135
|
[#1135]: https://github.com/tokio-rs/axum/pull/1135
|
||||||
[#1152]: https://github.com/tokio-rs/axum/pull/1152
|
[#1152]: https://github.com/tokio-rs/axum/pull/1152
|
||||||
|
[#1239]: https://github.com/tokio-rs/axum/pull/1239
|
||||||
[#924]: https://github.com/tokio-rs/axum/pull/924
|
[#924]: https://github.com/tokio-rs/axum/pull/924
|
||||||
|
|
||||||
# 0.5.10 (28. June, 2022)
|
# 0.5.10 (28. June, 2022)
|
||||||
|
@ -4,7 +4,7 @@ version = "0.5.10"
|
|||||||
categories = ["asynchronous", "network-programming", "web-programming::http-server"]
|
categories = ["asynchronous", "network-programming", "web-programming::http-server"]
|
||||||
description = "Web framework that focuses on ergonomics and modularity"
|
description = "Web framework that focuses on ergonomics and modularity"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56"
|
rust-version = "1.60"
|
||||||
homepage = "https://github.com/tokio-rs/axum"
|
homepage = "https://github.com/tokio-rs/axum"
|
||||||
keywords = ["http", "web", "framework"]
|
keywords = ["http", "web", "framework"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -13,17 +13,17 @@ repository = "https://github.com/tokio-rs/axum"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["form", "http1", "json", "matched-path", "original-uri", "query", "tower-log"]
|
default = ["form", "http1", "json", "matched-path", "original-uri", "query", "tower-log"]
|
||||||
form = ["serde_urlencoded"]
|
form = ["dep:serde_urlencoded"]
|
||||||
http1 = ["hyper/http1"]
|
http1 = ["hyper/http1"]
|
||||||
http2 = ["hyper/http2"]
|
http2 = ["hyper/http2"]
|
||||||
json = ["serde_json"]
|
json = ["dep:serde_json"]
|
||||||
macros = ["axum-macros"]
|
macros = ["dep:axum-macros"]
|
||||||
matched-path = []
|
matched-path = []
|
||||||
multipart = ["multer"]
|
multipart = ["dep:multer"]
|
||||||
original-uri = []
|
original-uri = []
|
||||||
query = ["serde_urlencoded"]
|
query = ["dep:serde_urlencoded"]
|
||||||
tower-log = ["tower/log"]
|
tower-log = ["tower/log"]
|
||||||
ws = ["tokio-tungstenite", "sha-1", "base64"]
|
ws = ["dep:tokio-tungstenite", "dep:sha-1", "dep:base64"]
|
||||||
|
|
||||||
# Required for intra-doc links to resolve correctly
|
# Required for intra-doc links to resolve correctly
|
||||||
__private_docs = ["tower/full", "tower-http/full"]
|
__private_docs = ["tower/full", "tower-http/full"]
|
||||||
|
@ -117,7 +117,7 @@ This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in
|
|||||||
|
|
||||||
## Minimum supported Rust version
|
## Minimum supported Rust version
|
||||||
|
|
||||||
axum's MSRV is 1.56.
|
axum's MSRV is 1.60.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user