Loading crates/s3s/src/http/ordered_headers.rs +11 −11 Original line number Diff line number Diff line Loading @@ -80,17 +80,17 @@ impl<'a> OrderedHeaders<'a> { self.get_unique_pair(name.as_ref()).map(|(_, v)| v) } /// Finds headers by names. Time `O(mlogn)` #[must_use] pub fn find_multiple(&self, names: &[impl AsRef<str>]) -> Self { let mut headers: Vec<(&'a str, &'a str)> = Vec::new(); for name in names { for pair in self.get_all_pairs(name.as_ref()) { headers.push(pair); } } Self { headers } } // /// Finds headers by names. Time `O(mlogn)` // #[must_use] // pub fn find_multiple(&self, names: &[impl AsRef<str>]) -> Self { // let mut headers: Vec<(&'a str, &'a str)> = Vec::new(); // for name in names { // for pair in self.get_all_pairs(name.as_ref()) { // headers.push(pair); // } // } // Self { headers } // } /// Finds headers by names. Time `O(mlogn)` #[must_use] Loading crates/s3s/src/ops/signature.rs +12 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,18 @@ impl SignatureContext<'_> { let service = presigned_url.credential.aws_service; let signature = { let headers = self.hs.find_multiple(&presigned_url.signed_headers); let headers = self.hs.find_multiple_with_on_missing(&presigned_url.signed_headers, |name| { // HTTP/2 replaces `host` header with `:authority` // but `:authority` is not in the request headers // so we need to add it back if `host` is in the signed headers if name == "host" && self.req_version == ::http::Version::HTTP_2 { if let Some(authority) = self.req_uri.authority() { return Some(authority.as_str()); } } None }); let method = &self.req_method; let uri_path = &self.decoded_uri_path; Loading crates/s3s/src/sig_v4/methods.rs +1 −1 Original line number Diff line number Diff line Loading @@ -847,7 +847,7 @@ mod tests { let signed_headers = OrderedHeaders::from_headers(req.headers()) .unwrap() .find_multiple(signed_header_names); .find_multiple_with_on_missing(signed_header_names, |_| None); let canonical_request = create_canonical_request(req.method(), uri_path, query_strings, &signed_headers, payload); Loading Loading
crates/s3s/src/http/ordered_headers.rs +11 −11 Original line number Diff line number Diff line Loading @@ -80,17 +80,17 @@ impl<'a> OrderedHeaders<'a> { self.get_unique_pair(name.as_ref()).map(|(_, v)| v) } /// Finds headers by names. Time `O(mlogn)` #[must_use] pub fn find_multiple(&self, names: &[impl AsRef<str>]) -> Self { let mut headers: Vec<(&'a str, &'a str)> = Vec::new(); for name in names { for pair in self.get_all_pairs(name.as_ref()) { headers.push(pair); } } Self { headers } } // /// Finds headers by names. Time `O(mlogn)` // #[must_use] // pub fn find_multiple(&self, names: &[impl AsRef<str>]) -> Self { // let mut headers: Vec<(&'a str, &'a str)> = Vec::new(); // for name in names { // for pair in self.get_all_pairs(name.as_ref()) { // headers.push(pair); // } // } // Self { headers } // } /// Finds headers by names. Time `O(mlogn)` #[must_use] Loading
crates/s3s/src/ops/signature.rs +12 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,18 @@ impl SignatureContext<'_> { let service = presigned_url.credential.aws_service; let signature = { let headers = self.hs.find_multiple(&presigned_url.signed_headers); let headers = self.hs.find_multiple_with_on_missing(&presigned_url.signed_headers, |name| { // HTTP/2 replaces `host` header with `:authority` // but `:authority` is not in the request headers // so we need to add it back if `host` is in the signed headers if name == "host" && self.req_version == ::http::Version::HTTP_2 { if let Some(authority) = self.req_uri.authority() { return Some(authority.as_str()); } } None }); let method = &self.req_method; let uri_path = &self.decoded_uri_path; Loading
crates/s3s/src/sig_v4/methods.rs +1 −1 Original line number Diff line number Diff line Loading @@ -847,7 +847,7 @@ mod tests { let signed_headers = OrderedHeaders::from_headers(req.headers()) .unwrap() .find_multiple(signed_header_names); .find_multiple_with_on_missing(signed_header_names, |_| None); let canonical_request = create_canonical_request(req.method(), uri_path, query_strings, &signed_headers, payload); Loading