Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public HttpRequest convert(final List<Header> headers) throws HttpException {
path = value;
break;
case H2PseudoRequestHeaders.AUTHORITY:
if (authority != null) {
throw new ProtocolException("Multiple '%s' request headers are illegal", name);
}
authority = value;
break;
case H2PseudoRequestHeaders.PROTOCOL:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,26 @@ void testInvalidOptionsNeitherAsteriskNorRoot() {
Assertions.assertThrows(ProtocolException.class, () -> converter.convert(headers));
}

@Test
void testConvertFromFieldsMultipleAuthority() {
final List<Header> headers = Arrays.asList(
new BasicHeader(":method", "GET"),
new BasicHeader(":scheme", "https"),
new BasicHeader(":authority", "www.example.com"),
new BasicHeader(":authority", "www2.example.com"),
new BasicHeader(":path", "/"));

final DefaultH2RequestConverter converter = new DefaultH2RequestConverter();

final ProtocolException ex = Assertions.assertThrows(
ProtocolException.class,
() -> converter.convert(headers));

Assertions.assertTrue(
ex.getMessage().contains("Multiple ':authority' request headers are illegal"),
ex::getMessage);
}


}

Loading