pub fn normalize_request(
method: Method,
scheme: &str,
authority: &str,
path: &str,
query: &str,
headers: &[(&str, &str)],
protocol: Protocol,
transport: Transport,
) -> Result<CanonicalRequest, NormalizeError>Expand description
规范化 HTTP 请求
将原始 HTTP 请求元素规范化为统一的 CanonicalRequest。 此函数执行单次遍历,消除协议差分攻击风险。
§Arguments
method- HTTP 方法scheme- URL 方案(http/https)authority- 授权主机(host:port)path- 请求路径query- 查询字符串headers- 请求头列表protocol- 协议类型transport- 传输层类型
§Returns
Ok(CanonicalRequest)- 规范化后的请求Err(NormalizeError)- 规范化失败