diff options
author | gjoranv <gv@verizonmedia.com> | 2019-07-02 14:20:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02 14:20:29 +0200 |
commit | 068396ccb9a634c7f8101a77c345dce491804bef (patch) | |
tree | be7d93d0612202c26875fc18e1e476f1964feb00 | |
parent | 8827326ec7d76e04bac491ea23eb1a9d82418d92 (diff) | |
parent | 7c26f5753befec8cf28adc4a86b9e67308f657c5 (diff) |
Merge pull request #9938 from vespa-engine/bjorncs/upgrade-jetty
Bjorncs/upgrade jetty
9 files changed, 25 insertions, 27 deletions
diff --git a/athenz-identity-provider-service/src/main/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/ConfigserverSslContextFactoryProvider.java b/athenz-identity-provider-service/src/main/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/ConfigserverSslContextFactoryProvider.java index 2bda2eb3627..0eeeae457b6 100644 --- a/athenz-identity-provider-service/src/main/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/ConfigserverSslContextFactoryProvider.java +++ b/athenz-identity-provider-service/src/main/java/com/yahoo/vespa/hosted/athenz/instanceproviderservice/ConfigserverSslContextFactoryProvider.java @@ -110,7 +110,7 @@ public class ConfigserverSslContextFactoryProvider extends AbstractComponent imp // TODO Use DefaultTlsContext to configure SslContextFactory (ensure that cipher/protocol configuration is same across all TLS endpoints) - SslContextFactory factory = new SslContextFactory(); + SslContextFactory.Server factory = new SslContextFactory.Server(); factory.setWantClientAuth(true); diff --git a/container-dependency-versions/pom.xml b/container-dependency-versions/pom.xml index 48cd9da9a01..0c27d074871 100644 --- a/container-dependency-versions/pom.xml +++ b/container-dependency-versions/pom.xml @@ -452,7 +452,7 @@ <guava.version>20.0</guava.version> <guice.version>3.0</guice.version> <jaxb.version>2.3.0</jaxb.version> - <jetty.version>9.4.15.v20190215</jetty.version> + <jetty.version>9.4.19.v20190610</jetty.version> <slf4j.version>1.7.5</slf4j.version> <!-- These must be kept in sync with version used by current jersey2.version. --> diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tls/ControllerSslContextFactoryProvider.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tls/ControllerSslContextFactoryProvider.java index 84d43314412..d50d141d625 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tls/ControllerSslContextFactoryProvider.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/tls/ControllerSslContextFactoryProvider.java @@ -58,7 +58,7 @@ public class ControllerSslContextFactoryProvider extends AbstractComponent imple private SslContextFactory createSslContextFactory(int port) { // TODO Use DefaultTlsContext to configure SslContextFactory (ensure that cipher/protocol configuration is same across all TLS endpoints). - SslContextFactory factory = new SslContextFactory(); + SslContextFactory.Server factory = new SslContextFactory.Server(); if (port != 443) { factory.setWantClientAuth(true); } diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/Cookie.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/Cookie.java index 06c93db7ede..a2c9a2cab82 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/Cookie.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/Cookie.java @@ -2,10 +2,7 @@ package com.yahoo.jdisc.http; import org.eclipse.jetty.server.CookieCutter; -import org.eclipse.jetty.server.Response; -import java.net.HttpCookie; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -15,6 +12,8 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import static java.util.stream.Collectors.toList; + /** * A RFC 6265 compliant cookie. * @@ -154,7 +153,7 @@ public class Cookie { public static String toCookieHeader(Iterable<? extends Cookie> cookies) { return StreamSupport.stream(cookies.spliterator(), false) .map(cookie -> { - HttpCookie httpCookie = new HttpCookie(cookie.getName(), cookie.getValue()); + java.net.HttpCookie httpCookie = new java.net.HttpCookie(cookie.getName(), cookie.getValue()); httpCookie.setDomain(cookie.getDomain()); httpCookie.setHttpOnly(cookie.isHttpOnly()); httpCookie.setMaxAge(cookie.getMaxAge(TimeUnit.SECONDS)); @@ -181,23 +180,22 @@ public class Cookie { cookie.setHttpOnly(servletCookie.isHttpOnly()); return cookie; }) - .collect(Collectors.toList()); + .collect(toList()); } public static List<String> toSetCookieHeaders(Iterable<? extends Cookie> cookies) { - // Ugly, bot Jetty does not provide a dedicated cookie parser (will be included in Jetty 10) - Response response = new Response(null, null); - for (Cookie cookie : cookies) { - response.addSetRFC6265Cookie( - cookie.getName(), - cookie.getValue(), - cookie.getDomain(), - cookie.getPath(), - cookie.getMaxAge(TimeUnit.SECONDS), - cookie.isSecure(), - cookie.isHttpOnly()); - } - return new ArrayList<>(response.getHeaders("Set-Cookie")); + return StreamSupport.stream(cookies.spliterator(), false) + .map(cookie -> + new org.eclipse.jetty.http.HttpCookie( + cookie.getName(), + cookie.getValue(), + cookie.getDomain(), + cookie.getPath(), + cookie.getMaxAge(TimeUnit.SECONDS), + cookie.isSecure(), + cookie.isHttpOnly() + ).getRFC6265SetCookie()) + .collect(toList()); } @Deprecated // TODO Vespa 8 Remove @@ -206,7 +204,7 @@ public class Cookie { } public static Cookie fromSetCookieHeader(String headerVal) { - return HttpCookie.parse(headerVal).stream() + return java.net.HttpCookie.parse(headerVal).stream() .map(httpCookie -> { Cookie cookie = new Cookie(); cookie.setName(httpCookie.getName()); diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/ConfiguredSslContextFactoryProvider.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/ConfiguredSslContextFactoryProvider.java index 2021105fc52..22168352fbe 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/ConfiguredSslContextFactoryProvider.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/ConfiguredSslContextFactoryProvider.java @@ -37,7 +37,7 @@ public class ConfiguredSslContextFactoryProvider implements SslContextFactoryPro public SslContextFactory getInstance(String containerId, int port) { ConnectorConfig.Ssl sslConfig = connectorConfig.ssl(); if (!sslConfig.enabled()) throw new IllegalStateException(); - SslContextFactory factory = new JDiscSslContextFactory(); + SslContextFactory.Server factory = new JDiscSslContextFactory(); switch (sslConfig.clientAuth()) { case NEED_AUTH: diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/JDiscSslContextFactory.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/JDiscSslContextFactory.java index 90d67996402..4d3bb4a280a 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/JDiscSslContextFactory.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/JDiscSslContextFactory.java @@ -13,7 +13,7 @@ import java.util.Objects; * * @author bjorncs */ -class JDiscSslContextFactory extends SslContextFactory { +class JDiscSslContextFactory extends SslContextFactory.Server { private String trustStorePassword; diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/TlsContextManagedSslContextFactory.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/TlsContextManagedSslContextFactory.java index d7d28e7d242..a5652042f9e 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/TlsContextManagedSslContextFactory.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/impl/TlsContextManagedSslContextFactory.java @@ -13,7 +13,7 @@ import java.net.InetSocketAddress; * * @author bjorncs */ -class TlsContextManagedSslContextFactory extends SslContextFactory { +class TlsContextManagedSslContextFactory extends SslContextFactory.Server { private final TlsContext tlsContext; diff --git a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/CookieTestCase.java b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/CookieTestCase.java index a367edb084f..709a9484349 100644 --- a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/CookieTestCase.java +++ b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/CookieTestCase.java @@ -113,7 +113,7 @@ public class CookieTestCase { @Test public void requireThatSetCookieCanBeEncoded() { assertEncodeSetCookie( - Collections.singletonList("foo.name=foo.value;Path=path;Domain=domain;Secure;HttpOnly"), + Collections.singletonList("foo.name=foo.value; Path=path; Domain=domain; Secure; HttpOnly"), Collections.singletonList(newSetCookie("foo"))); } diff --git a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java index aecd3854408..ec9c90ffa50 100644 --- a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java +++ b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java @@ -407,7 +407,7 @@ public class HttpServerTest { driver.client().get("/status.html") .expectStatusCode(is(OK)) .expectHeader("Set-Cookie", - is("foo=bar;Path=/foopath;Domain=.localhost;Secure;HttpOnly")); + is("foo=bar; Path=/foopath; Domain=.localhost; Secure; HttpOnly")); assertThat(driver.close(), is(true)); } |