Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default header size increased to 16K - Helidon 3.x #5016

Merged
merged 4 commits into from
Sep 30, 2022
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
2 changes: 1 addition & 1 deletion docs/config/io_helidon_webserver_SocketConfiguration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Type: link:{javadoc-base-url}/io.helidon.webserver/io/helidon/webserver/SocketCo

Default is `false`
|`host` |string |{nbsp} |A helper method that just calls #bindAddress(String).
|`max-header-size` |int |`8192` |Maximal number of bytes of all header values combined. When a bigger value is received, a
|`max-header-size` |int |`16384` |Maximal number of bytes of all header values combined. When a bigger value is received, a
io.helidon.common.http.Http.Status#BAD_REQUEST_400
is returned.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Type: link:{javadoc-base-url}/io.helidon.webserver.SocketConfiguration/io/helido

Default is `false`
|`host` |string |{nbsp} |A helper method that just calls #bindAddress(String).
|`max-header-size` |int |`8192` |Maximal number of bytes of all header values combined. When a bigger value is received, a
|`max-header-size` |int |`16384` |Maximal number of bytes of all header values combined. When a bigger value is received, a
io.helidon.common.http.Http.Status#BAD_REQUEST_400
is returned.

Expand Down
2 changes: 1 addition & 1 deletion docs/config/io_helidon_webserver_WebServer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This is a standalone configuration type, prefix from configuration root: `server
Default is `false`
|`features.print-details` |boolean |`false` |Set to `true` to print detailed feature information on startup.
|`host` |string |{nbsp} |A helper method that just calls #bindAddress(String).
|`max-header-size` |int |`8192` |Maximal number of bytes of all header values combined. When a bigger value is received, a
|`max-header-size` |int |`16384` |Maximal number of bytes of all header values combined. When a bigger value is received, a
io.helidon.common.http.Http.Status#BAD_REQUEST_400
is returned.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,12 @@ default B tls(Supplier<WebServerTls> tlsConfig) {
* {@link io.helidon.common.http.Http.Status#BAD_REQUEST_400}
* is returned.
* <p>
* Default is {@code 8192}
* Default is {@code 16384}
*
* @param size maximal number of bytes of combined header values
* @return this builder
*/
@ConfiguredOption("8192")
@ConfiguredOption("16384")
B maxHeaderSize(int size);

/**
Expand Down Expand Up @@ -483,8 +483,9 @@ final class Builder implements SocketConfigurationBuilder<Builder>, io.helidon.c
// methods with `name` are removed from server builder (for adding sockets)
private String name = UNCONFIGURED_NAME;
private boolean enabled = true;
// header size doubled comparing to default netty size
private int maxHeaderSize = 16384;
// these values are as defined in Netty implementation
private int maxHeaderSize = 8192;
private int maxInitialLineLength = 4096;
private int maxChunkSize = 8192;
private boolean validateHeaders = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ void testDefaults() {
.validateHeaders(false)
.build();

testHeader(client, 8000, true);
testHeader(client, 16000, true);
testInitialLine(client, 10, true);

testHeader(client, 8900, false);
testHeader(client, 8900, false);
testHeader(client, 17000, false);
testHeader(client, 17000, false);

// now test with big initial line
testInitialLine(client, 5000, false);
Expand All @@ -74,7 +74,7 @@ void testCustom() {
.host("localhost")
.routing(r -> r.any((req, res) -> res.send("any")))
.config(config)
.maxHeaderSize(9100)
.maxHeaderSize(16400)
.maxInitialLineLength(5100)
.build()
.start()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates.
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,13 +69,13 @@ static void destroyClass() throws InterruptedException, ExecutionException, Time

@Test
void testOkHeader() {
testHeader(8000, true);
testHeader(16000, true);
}

@Test
void testLongHeader() {
testHeader(8900, false);
testHeader(8900, false);
testHeader(17000, false);
testHeader(17000, false);
}

@Test
Expand Down