aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-07-15 15:50:23 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-07-15 16:06:04 +0200
commit691d9b59443c06c066c74e80a5a05148e3539cb7 (patch)
tree1d3b93346dbe387b0ee5ad3ed998c36cee316bfa
parent1a5ffe4643b7f0be9b4223958c016594510663fe (diff)
Test HTTP request using empty URI path segment
-rw-r--r--container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java
index bd3000a0188..86a3808becc 100644
--- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java
+++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java
@@ -701,6 +701,28 @@ public class HttpServerTest {
.set(MetricDefinitions.REQUESTS_PER_CONNECTION, 1L, MetricConsumerMock.STATIC_CONTEXT);
}
+ @Test
+ public void uriWithEmptyPathSegmentIsAllowed() throws Exception {
+ Path privateKeyFile = tmpFolder.newFile().toPath();
+ Path certificateFile = tmpFolder.newFile().toPath();
+ generatePrivateKeyAndCertificate(privateKeyFile, certificateFile);
+ MetricConsumerMock metricConsumer = new MetricConsumerMock();
+ InMemoryConnectionLog connectionLog = new InMemoryConnectionLog();
+ JettyTestDriver driver = createSslTestDriver(certificateFile, privateKeyFile, metricConsumer, connectionLog);
+ String uriPath = "/path/with/empty//segment";
+
+ // HTTP/1.1
+ driver.client().get(uriPath).expectStatusCode(is(OK));
+
+ // HTTP/2
+ try (CloseableHttpAsyncClient client = createHttp2Client(driver)) {
+ String uri = "https://localhost:" + driver.server().getListenPort() + uriPath;
+ SimpleHttpResponse response = client.execute(SimpleRequestBuilder.get(uri).build(), null).get();
+ assertEquals(OK, response.getCode());
+ }
+
+ assertTrue(driver.close());
+ }
private static CloseableHttpAsyncClient createHttp2Client(JettyTestDriver driver) {
TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create()