Skip to content

Commit

Permalink
Add property for headers excluded from signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jul 6, 2023
1 parent d992027 commit 10045f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
1 change: 1 addition & 0 deletions defaults/src/main/resources/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ ftp.timezone.default=
# Authentication header version
# s3.signature.version=AWS2
s3.signature.version=AWS4HMACSHA256
s3.signature.headers.exclude=Connection Authorization Proxy-Authorization Proxy-Connection

# Default bucket location
s3.location=us-east-1
Expand Down
19 changes: 2 additions & 17 deletions s3/src/main/java/ch/cyberduck/core/s3/S3Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,8 @@ public void process(final HttpRequest request, final HttpContext context) throws
final class HttpHeaderFilter implements Predicate<Header> {
@Override
public boolean test(final Header header) {
if(HttpHeaders.AUTHORIZATION.equals(header.getName())) {
// Delete any previously set authorization header
return false;
}
if(HttpHeaders.CONNECTION.equals(header.getName())) {
return false;
}
if(HttpHeaders.PROXY_AUTHORIZATION.equals(header.getName())) {
return false;
}
if(HttpHeaders.PROXY_AUTHENTICATE.equals(header.getName())) {
return false;
}
if("Proxy-Connection".equals(header.getName())) {
return false;
}
return true;
return !new HostPreferences(host).getList("s3.signature.headers.exclude").stream()
.filter(s -> StringUtils.equalsIgnoreCase(s, header.getName())).findAny().isPresent();
}
}

Expand Down

0 comments on commit 10045f4

Please sign in to comment.