Skip to content

Commit

Permalink
Configure Jetty to use legacy compliance
Browse files Browse the repository at this point in the history
This prevents changing header value cases which previously caused S3
signature mismatches.  Fixes #392.
References jetty/jetty.project#7168.
  • Loading branch information
gaul committed Jan 22, 2022
1 parent 2839107 commit 2e61c38
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/main/java/org/gaul/s3proxy/S3Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import com.google.common.base.Strings;
import com.google.common.collect.Lists;

import org.eclipse.jetty.http.HttpCompliance;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
Expand All @@ -51,12 +53,6 @@ public final class S3Proxy {
private final boolean listenHTTP;
private final boolean listenHTTPS;

static {
// Prevent Jetty from rewriting headers:
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=414449
System.setProperty("org.eclipse.jetty.http.HttpParser.STRICT", "true");
}

S3Proxy(Builder builder) {
checkArgument(builder.endpoint != null ||
builder.secureEndpoint != null,
Expand Down Expand Up @@ -89,7 +85,8 @@ public final class S3Proxy {
}

HttpConnectionFactory httpConnectionFactory =
new HttpConnectionFactory();
new HttpConnectionFactory(
new HttpConfiguration(), HttpCompliance.LEGACY);
ServerConnector connector;
if (builder.endpoint != null) {
connector = new ServerConnector(server, httpConnectionFactory);
Expand Down

0 comments on commit 2e61c38

Please sign in to comment.