tustvold commented on code in PR #512:
URL:
https://github.com/apache/arrow-rs-object-store/pull/512#discussion_r2443445602
##########
src/aws/credential.rs:
##########
@@ -452,7 +456,7 @@ fn canonicalize_headers(header_map: &HeaderMap) -> (String,
String) {
if value_idx != 0 {
canonical_headers.push(',');
}
- canonical_headers.push_str(value.trim());
+ canonical_headers.push_str(&normalize_whitespace(value));
Review Comment:
It seems rather wasteful to allocate both a Vec and a String only to append
there contents to another string.
Perhaps we could just do something like (not tested)
```
let mut iter = value.trim().split(' ').filter(|x| !x.is_empty());
if let Some(first) = iter.next() {
canonical_headers.push(first);
for x in iter {
canonical_headers.push(' ');
canonical_headers.push(x);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]