Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignV4: trim leading/trailing spaces in header value #1578

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api/src/main/java/io/minio/Signer.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ private void setCanonicalHeaders(Set<String> ignored_headers) {
// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
// * Header having multiple values should be converted to comma separated values.
// * Multi-spaced value of header should be trimmed to single spaced value.
// * Trim leading/trailing spaces in header value (As OkHttp trims leading/trailing spaces
// automatically, this is added for completion).
this.canonicalHeaders.put(
signedHeader,
headers.values(name).stream()
.map(
value -> {
return value.replaceAll("( +)", " ");
return value.replaceAll("( +)", " ").trim();
})
.collect(Collectors.joining(",")));
}
Expand Down
Loading