Skip to content

Commit

Permalink
Merge pull request #24625 from vespa-engine/bjorncs/revert-jetty
Browse files Browse the repository at this point in the history
Bjorncs/revert jetty
  • Loading branch information
bjorncs authored Oct 27, 2022
2 parents 92c1d01 + c93aa5e commit 82dc6c8
Show file tree
Hide file tree
Showing 34 changed files with 228 additions and 356 deletions.
30 changes: 12 additions & 18 deletions application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@

<!-- START JETTY embedded jars -->
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>http2-common</artifactId>
<groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>alpn-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
Expand All @@ -150,44 +150,36 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<artifactId>jetty-continuation</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<artifactId>jetty-servlets</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-jakarta-servlet-api</artifactId>
</dependency>
<!-- END JETTY embedded jars -->

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand All @@ -198,6 +190,8 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<!-- END JETTY embedded jars -->

</dependencies>

<build>
Expand Down
9 changes: 6 additions & 3 deletions cloud-tenant-base-dependencies-enforcer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<javax.ws.rs-api.version>2.0.1</javax.ws.rs-api.version>
<jaxb.version>2.3.0</jaxb.version>
<jetty.version>11.0.12</jetty.version>
<jetty.version>9.4.49.v20220914</jetty.version>
<jetty-alpn.version>1.1.3.v20160715</jetty-alpn.version>
<org.lz4.version>1.8.0</org.lz4.version>
<org.json.version>20220320</org.json.version> <!-- TODO: Remove on Vespa 9 -->
<slf4j.version>1.7.32</slf4j.version> <!-- WARNING: when updated, also update c.y.v.tenant:base pom -->
Expand Down Expand Up @@ -199,20 +200,22 @@
<include>org.bouncycastle:bcpkix-jdk18on:[${bouncycastle.version}]:jar:test</include>
<include>org.bouncycastle:bcprov-jdk18on:[${bouncycastle.version}]:jar:test</include>
<include>org.bouncycastle:bcutil-jdk18on:[${bouncycastle.version}]:jar:test</include>
<include>org.eclipse.jetty.alpn:alpn-api:[${jetty-alpn.version}]:jar:test</include>
<include>org.eclipse.jetty.http2:http2-common:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty.http2:http2-hpack:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty.http2:http2-server:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2:jar:test</include>
<include>org.eclipse.jetty:jetty-alpn-client:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-alpn-java-server:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-alpn-server:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-client:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-continuation:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-http:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-io:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-jmx:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-security:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-server:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-servlet:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-servlets:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-util-ajax:[${jetty.version}]:jar:test</include>
<include>org.eclipse.jetty:jetty-util:[${jetty.version}]:jar:test</include>
<include>org.hamcrest:hamcrest-core:1.3:jar:test</include>
<include>org.hdrhistogram:HdrHistogram:2.1.8:jar:test</include>
Expand Down
93 changes: 9 additions & 84 deletions container-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<artifactId>container-core</artifactId>
<version>8-SNAPSHOT</version>
<packaging>container-plugin</packaging>

<dependencies>

<!-- COMPILE scope -->
Expand Down Expand Up @@ -115,119 +114,40 @@

<!-- START JETTY embedded jars -->
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>http2-common</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
<groupId>org.eclipse.jetty.alpn</groupId>
<artifactId>alpn-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>http2-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- Required for JDK9ServerALPNProcessor through ServiceLoader API -->
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
<artifactId>jetty-continuation</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-jakarta-servlet-api</artifactId>
<artifactId>jetty-servlets</artifactId>
</dependency>
<!-- END JETTY embedded jars -->

Expand Down Expand Up @@ -335,6 +255,11 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
package com.yahoo.container.jdisc.utils;

import com.yahoo.container.jdisc.HttpRequest;
import jakarta.servlet.http.Part;
import org.eclipse.jetty.server.MultiPartFormInputStream;
import org.eclipse.jetty.http.MultiPartFormInputStream;

import javax.servlet.http.Part;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
Expand Down
4 changes: 2 additions & 2 deletions container-core/src/main/java/com/yahoo/jdisc/http/Cookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package com.yahoo.jdisc.http;

import org.eclipse.jetty.http.HttpCookie;
import org.eclipse.jetty.server.Cookies;
import org.eclipse.jetty.server.CookieCutter;

import java.util.Arrays;
import java.util.HashSet;
Expand Down Expand Up @@ -180,7 +180,7 @@ public static String toCookieHeader(Iterable<? extends Cookie> cookies) {
}

public static List<Cookie> fromCookieHeader(String headerVal) {
Cookies cookieCutter = new Cookies();
CookieCutter cookieCutter = new CookieCutter();
cookieCutter.addCookieField(headerVal);
return Arrays.stream(cookieCutter.getCookies())
.map(servletCookie -> {
Expand Down
16 changes: 11 additions & 5 deletions container-core/src/main/java/com/yahoo/jdisc/http/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.jdisc.handler.ResponseHandler;
import com.yahoo.jdisc.service.CurrentContainer;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.UrlEncoded;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.URI;
import java.security.Principal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
Expand Down Expand Up @@ -115,10 +116,15 @@ private HttpRequest(Request parent, URI uri, Method method, Version version) {
}

private static Map<String, List<String>> getUriQueryParameters(URI uri) {
if (uri.getRawQuery() == null) return Map.of();
MultiMap<String> params = new MultiMap<>();
UrlEncoded.decodeUtf8To(uri.getRawQuery(), params);
return Map.copyOf(params);
MultiMap<String> queryParameters = new MultiMap<>();
new HttpURI(uri).decodeQueryTo(queryParameters);

// Do a deep copy so we do not leak Jetty classes outside
Map<String, List<String>> deepCopiedQueryParameters = new HashMap<>();
for (Map.Entry<String, List<String>> entry : queryParameters.entrySet()) {
deepCopiedQueryParameters.put(entry.getKey(), new ArrayList<>(entry.getValue()));
}
return deepCopiedQueryParameters;
}

public Method getMethod() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.yahoo.container.logging.RequestLogEntry;
import com.yahoo.jdisc.http.HttpRequest;
import com.yahoo.jdisc.http.ServerConfig;
import jakarta.servlet.http.HttpServletRequest;
import org.eclipse.jetty.http2.HTTP2Stream;
import org.eclipse.jetty.http2.server.HttpTransportOverHTTP2;
import org.eclipse.jetty.server.HttpChannel;
Expand All @@ -17,6 +16,7 @@
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.component.AbstractLifeCycle;

import javax.servlet.http.HttpServletRequest;
import java.security.cert.X509Certificate;
import java.time.Duration;
import java.time.Instant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import com.yahoo.security.tls.MixedMode;
import com.yahoo.security.tls.TransportSecurityUtils;
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
import org.eclipse.jetty.http.HttpCompliance;
import org.eclipse.jetty.http.UriCompliance;
import org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory;
import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
Expand Down Expand Up @@ -139,12 +137,8 @@ private HttpConfiguration newHttpConfiguration() {
httpConfig.setOutputBufferSize(connectorConfig.outputBufferSize());
httpConfig.setRequestHeaderSize(connectorConfig.requestHeaderSize());
httpConfig.setResponseHeaderSize(connectorConfig.responseHeaderSize());
httpConfig.setHttpCompliance(HttpCompliance.RFC7230);
// TODO Vespa 9 Use default URI compliance (LEGACY == old Jetty 9.4 compliance)
httpConfig.setUriCompliance(UriCompliance.LEGACY);
if (isSslEffectivelyEnabled(connectorConfig)) {
// Explicitly disable SNI checking as Jetty's SNI checking trust manager is not part of our SSLContext trust manager chain
httpConfig.addCustomizer(new SecureRequestCustomizer(false, false, -1, false));
httpConfig.addCustomizer(new SecureRequestCustomizer());
}
String serverNameFallback = connectorConfig.serverName().fallback();
if (!serverNameFallback.isBlank()) httpConfig.setServerAuthority(new HostPort(serverNameFallback));
Expand Down Expand Up @@ -180,7 +174,7 @@ private SslConnectionFactory newSslConnectionFactory(Metric metric, ConnectionFa
return connectionFactory;
}

private SslContextFactory.Server createSslContextFactory() {
private SslContextFactory createSslContextFactory() {
DefaultConnectorSsl ssl = new DefaultConnectorSsl();
sslProvider.configureSsl(ssl, connectorConfig.name(), connectorConfig.listenPort());
return ssl.createSslContextFactory();
Expand Down
Loading

0 comments on commit 82dc6c8

Please sign in to comment.