pub fn resolve(root: &Path, request_path: &str) -> Result<PathBuf, StaticError>Expand description
Resolve a request path under a root directory, canonicalizing the root first.
This is a convenience wrapper around resolve_with_canonical_root() that canonicalizes
the root on every call. For production use where the root is fixed at startup, prefer
Server::new() which canonicalizes the root once and reuses it for all requests.
§Arguments
root- The server root directory (need not be pre-canonicalized).request_path- The HTTP request path (e.g.,/path/to/file.html).
§Returns
Ok(PathBuf)if the path resolves to a file within root.Err(StaticError)if the path is invalid, missing, or attempts traversal.Err(StaticError::Io)if canonicalizing the root fails.