mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Deprecate Host and Scheme extractors
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#![allow(deprecated)]
|
||||
|
||||
use super::rejection::{FailedToResolveHost, HostRejection};
|
||||
use axum_core::{
|
||||
extract::{FromRequestParts, OptionalFromRequestParts},
|
||||
@@ -25,6 +27,7 @@ const X_FORWARDED_HOST_HEADER_KEY: &str = "X-Forwarded-Host";
|
||||
///
|
||||
/// Note that user agents can set `X-Forwarded-Host` and `Host` headers to arbitrary values so make
|
||||
/// sure to validate them to avoid security issues.
|
||||
#[deprecated = "will be removed in the next version; see https://github.com/tokio-rs/axum/issues/3442"]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Host(pub String);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ mod scheme;
|
||||
#[cfg(feature = "optional-path")]
|
||||
pub use self::optional_path::OptionalPath;
|
||||
|
||||
#[allow(deprecated)]
|
||||
pub use self::host::Host;
|
||||
|
||||
#[cfg(feature = "cached")]
|
||||
@@ -62,6 +63,7 @@ pub use self::query::{OptionalQueryRejection, Query, QueryRejection};
|
||||
#[cfg(feature = "multipart")]
|
||||
pub use self::multipart::Multipart;
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cfg(feature = "scheme")]
|
||||
#[doc(no_inline)]
|
||||
pub use self::scheme::{Scheme, SchemeMissing};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Extractor that parses the scheme of a request.
|
||||
//! See [`Scheme`] for more details.
|
||||
#![allow(deprecated)]
|
||||
|
||||
use axum_core::{__define_rejection as define_rejection, extract::FromRequestParts};
|
||||
use http::{
|
||||
@@ -17,6 +18,7 @@ const X_FORWARDED_PROTO_HEADER_KEY: &str = "X-Forwarded-Proto";
|
||||
///
|
||||
/// Note that user agents can set the `X-Forwarded-Proto` header to arbitrary values so make
|
||||
/// sure to validate them to avoid security issues.
|
||||
#[deprecated = "will be removed in the next version; see https://github.com/tokio-rs/axum/issues/3442"]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Scheme(pub String);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user