From ed7d490d76e95f78ecfb5514b2dd1c416da19615 Mon Sep 17 00:00:00 2001 From: Bouke van der Bijl Date: Wed, 29 Nov 2023 09:52:47 +0100 Subject: [PATCH] Update comment to link to RFC --- axum/src/extract/host.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/axum/src/extract/host.rs b/axum/src/extract/host.rs index a3189def0a..8039553fdb 100644 --- a/axum/src/extract/host.rs +++ b/axum/src/extract/host.rs @@ -11,13 +11,16 @@ use http::{ const X_FORWARDED_HOST_HEADER_KEY: &str = "X-Forwarded-Host"; -/// Extractor that resolves the hostname of the request. +/// Extractor that resolves the host of the request. /// -/// Hostname is resolved through the following, in order: +/// Host is resolved through the following, in order: /// - `Forwarded` header /// - `X-Forwarded-Host` header /// - `Host` header -/// - request target / URI +/// - Authority of the request URI +/// +/// See https://www.rfc-editor.org/rfc/rfc9110.html#name-host-and-authority for the definition of +/// 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.