Skip to main content

sanitize_domain

Function sanitize_domain 

Source
pub fn sanitize_domain(host: &str) -> Result<String>
Expand description

Sanitize and validate a domain name from an HTTP Host header.

Accepts valid DNS hostnames with optional port numbers. Rejects domains containing path traversal characters, whitespace, or other unsafe characters.

Returns the sanitized, lowercased domain or an error if invalid.