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 Server and docs - Helidon 2.x #5018

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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/se/webserver/02_configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Available socket configuration options:
|`port` |{nbsp} |int |Port to open server socket on, defaults to an available ephemeral port
|`bind-address` |all local addresses |String |Address to listen on (may be an IPV6 address as well)
|`backlog` |`1024` |int |Maximum length of the queue of incoming connections on the server socket.
|`max-header-size` |`8192` |int |Maximal number of bytes of all header values combined. Returns `400` if headers are bigger
|`max-header-size` |`16384` |int |Maximal number of bytes of all header values combined. Returns `400` if headers are bigger
|`max-initial-line-length` |`4096` |int |Maximal number of characters in the initial HTTP line. Returns `400` if line is longer
|`timeout-millis` |no timeout| long |Server socket timeout.
|`receive-buffer-size` |implementation default |int |Proposed value of the TCP receive window that is advertised to the remote peer on the server socket.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,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 @@ -516,8 +516,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 increased to 16K
private int maxHeaderSize = 16384;
danielkec marked this conversation as resolved.
Show resolved Hide resolved
// 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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021 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 @@ -52,11 +52,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 @@ -76,7 +76,7 @@ void testCustom() {
.any((req, res) -> res.send("any"))
.build())
.config(config)
.maxHeaderSize(9100)
.maxHeaderSize(16400)
.maxInitialLineLength(5100)
.build()
.start()
Expand All @@ -87,11 +87,11 @@ void testCustom() {
.validateHeaders(false)
.build();

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

testHeader(client, 8900, true);
testHeader(client, 8900, true);
testHeader(client, 17000, false);
testHeader(client, 17000, false);
danielkec marked this conversation as resolved.
Show resolved Hide resolved

// now test with big initial line
testInitialLine(client, 5000, true);
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