Skip to content

Commit

Permalink
Upgrade to Jetty 11.0.11
Browse files Browse the repository at this point in the history
Jetty 9 is EOL.  This requires Java 11 and updating some Java EE
imports.  Fixes #422.
  • Loading branch information
gaul committed Aug 7, 2022
1 parent 277ef3c commit 27d5ad7
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.4.45.v20220203</version>
<version>11.0.11</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/gaul/s3proxy/AwsSignature.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import javax.annotation.Nullable;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;

import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
Expand All @@ -46,6 +45,8 @@
import com.google.common.net.HttpHeaders;
import com.google.common.net.PercentEscaper;

import jakarta.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/gaul/s3proxy/S3ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import static java.util.Objects.requireNonNull;

import javax.servlet.http.HttpServletResponse;

import com.google.common.base.CaseFormat;

import jakarta.servlet.http.HttpServletResponse;

/**
* List of S3 error codes. Reference:
* http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/org/gaul/s3proxy/S3Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.jetty.http.HttpCompliance;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandler;
Expand Down Expand Up @@ -84,9 +85,13 @@ public final class S3Proxy {
context.setContextPath(builder.servicePath);
}

HttpConfiguration httpConfiguration = new HttpConfiguration();
httpConfiguration.setHttpCompliance(HttpCompliance.LEGACY);
SecureRequestCustomizer src = new SecureRequestCustomizer();
src.setSniHostCheck(false);
httpConfiguration.addCustomizer(src);
HttpConnectionFactory httpConnectionFactory =
new HttpConnectionFactory(
new HttpConfiguration(), HttpCompliance.LEGACY);
new HttpConnectionFactory(httpConfiguration);
ServerConnector connector;
if (builder.endpoint != null) {
connector = new ServerConnector(server, httpConnectionFactory);
Expand All @@ -99,7 +104,7 @@ public final class S3Proxy {
}

if (builder.secureEndpoint != null) {
SslContextFactory sslContextFactory =
SslContextFactory.Server sslContextFactory =
new SslContextFactory.Server();
sslContextFactory.setKeyStorePath(builder.keyStorePath);
sslContextFactory.setKeyStorePassword(builder.keyStorePassword);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
import javax.annotation.Nullable;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
Expand Down Expand Up @@ -82,6 +80,9 @@
import com.google.common.net.HttpHeaders;
import com.google.common.net.PercentEscaper;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.MultipartStream;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.KeyNotFoundException;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/gaul/s3proxy/S3ProxyHandlerJetty.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
import java.util.concurrent.TimeoutException;

import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.common.collect.ImmutableMap;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.jclouds.blobstore.BlobStore;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/gaul/s3proxy/AwsSdkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ public void testBlobRemove() throws Exception {
@Test
public void testSinglepartUploadJettyCachedHeader() throws Exception {
String blobName = "singlepart-upload-jetty-cached";
String contentType = "text/plain;charset=utf-8";
String contentType = "text/plain";
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(BYTE_SOURCE.size());
metadata.setContentType(contentType);
Expand Down

0 comments on commit 27d5ad7

Please sign in to comment.