Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
This commit is contained in:
commit
04753e7804
|
@ -430,6 +430,13 @@
|
|||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-client-hotrod</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<!-- this is depending on an old log4j version which have this issue https://issues.apache.org/jira/browse/LOG4J2-3241 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- to make infinispan-common source sane -->
|
||||
<dependency>
|
||||
|
|
|
@ -684,6 +684,8 @@ public class ForwardedRequestCustomizer implements HttpConfiguration.Customizer
|
|||
|
||||
private void updateHandles()
|
||||
{
|
||||
_handles.clear();
|
||||
|
||||
MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
try
|
||||
{
|
||||
|
|
|
@ -35,7 +35,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
public class ForwardedRequestCustomizerTest
|
||||
{
|
||||
private Server server;
|
||||
private RequestHandler handler;
|
||||
private LocalConnector connector;
|
||||
private LocalConnector connectorAlt;
|
||||
private LocalConnector connectorConfigured;
|
||||
|
@ -96,7 +95,7 @@ public class ForwardedRequestCustomizerTest
|
|||
connectorConfigured = new LocalConnector(server, http);
|
||||
server.addConnector(connectorConfigured);
|
||||
|
||||
handler = new RequestHandler();
|
||||
RequestHandler handler = new RequestHandler();
|
||||
server.setHandler(handler);
|
||||
|
||||
handler.requestTester = (request, response) ->
|
||||
|
@ -1148,6 +1147,58 @@ public class ForwardedRequestCustomizerTest
|
|||
assertThat("status", response.getStatus(), is(400));
|
||||
}
|
||||
|
||||
public static Stream<Arguments> customHeaderNameRequestCases()
|
||||
{
|
||||
return Stream.of(
|
||||
Arguments.of(new TestRequest("Old name then new name")
|
||||
.headers(
|
||||
"GET / HTTP/1.1",
|
||||
"Host: myhost",
|
||||
"X-Forwarded-For: 1.1.1.1",
|
||||
"X-Custom-For: 2.2.2.2"
|
||||
)
|
||||
.configureCustomizer((forwardedRequestCustomizer) ->
|
||||
forwardedRequestCustomizer.setForwardedForHeader("X-Custom-For")),
|
||||
new Expectations()
|
||||
.scheme("http").serverName("myhost").serverPort(80)
|
||||
.secure(false)
|
||||
.requestURL("http://myhost/")
|
||||
.remoteAddr("2.2.2.2").remotePort(0)
|
||||
),
|
||||
Arguments.of(new TestRequest("New name then old name")
|
||||
.headers(
|
||||
"GET / HTTP/1.1",
|
||||
"Host: myhost",
|
||||
"X-Custom-For: 2.2.2.2",
|
||||
"X-Forwarded-For: 1.1.1.1"
|
||||
)
|
||||
.configureCustomizer((forwardedRequestCustomizer) ->
|
||||
forwardedRequestCustomizer.setForwardedForHeader("X-Custom-For")),
|
||||
new Expectations()
|
||||
.scheme("http").serverName("myhost").serverPort(80)
|
||||
.secure(false)
|
||||
.requestURL("http://myhost/")
|
||||
.remoteAddr("2.2.2.2").remotePort(0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("customHeaderNameRequestCases")
|
||||
public void testCustomHeaderName(TestRequest request, Expectations expectations) throws Exception
|
||||
{
|
||||
request.configure(customizer);
|
||||
|
||||
String rawRequest = request.getRawRequest((header) -> header);
|
||||
// System.out.println(rawRequest);
|
||||
|
||||
HttpTester.Response response = HttpTester.parseResponse(connector.getResponse(rawRequest));
|
||||
assertThat("status", response.getStatus(), is(200));
|
||||
|
||||
expectations.accept(actual);
|
||||
}
|
||||
|
||||
|
||||
private static class TestRequest
|
||||
{
|
||||
String description;
|
||||
|
|
|
@ -136,6 +136,13 @@
|
|||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-client-hotrod</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<!-- this is depending on an old log4j version which have this issue https://issues.apache.org/jira/browse/LOG4J2-3241 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<name>Jetty :: GCloud</name>
|
||||
|
||||
<properties>
|
||||
<gcloud.version>2.5.1</gcloud.version>
|
||||
<gcloud.version>2.6.0</gcloud.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
<artifactId>infinispan-core</artifactId>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.wildfly.common</groupId>
|
||||
<artifactId>wildfly-common</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.wildfly.common</groupId>
|
||||
<artifactId>wildfly-common</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -68,6 +68,13 @@
|
|||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-client-hotrod</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<!-- this is depending on an old log4j version which have this issue https://issues.apache.org/jira/browse/LOG4J2-3241 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
|
|
|
@ -102,6 +102,13 @@
|
|||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-client-hotrod</artifactId>
|
||||
<exclusions>
|
||||
<!-- this is depending on an old log4j version which have this issue https://issues.apache.org/jira/browse/LOG4J2-3241 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
|
|
|
@ -81,6 +81,13 @@
|
|||
<groupId>org.infinispan</groupId>
|
||||
<artifactId>infinispan-client-hotrod</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<!-- this is depending on an old log4j version which have this issue https://issues.apache.org/jira/browse/LOG4J2-3241 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.infinispan</groupId>
|
||||
|
|
Loading…
Reference in New Issue