Skip to content

Commit

Permalink
Add configuration for http max initial line length
Browse files Browse the repository at this point in the history
Netty lets us configure tha maximum length of the initial length of an HTTP request. By default it's 4096.

https://netty.io/4.0/api/io/netty/handler/codec/http/HttpRequestDecoder.html
  • Loading branch information
pcasaes committed Jul 9, 2020
1 parent b043880 commit 58032a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/main/asciidoc/http-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ The following properties are supported.
|Property Name|Default|Description
|quarkus.http.limits.max-body-size| `10240K` |The maximum size of request body.
|quarkus.http.limits.max-header-size|`20K`|The maximum length of all headers.
|quarkus.http.limits.max-initial-line-length|`4096`|The max length of the initial line (e.g. {@code "GET / HTTP/1.0"}).
|===

[NOTE]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ public class ServerLimitsConfig {
*/
@ConfigItem
public Optional<MemorySize> maxChunkSize;

/**
* If present will configure the max length of the initial line (e.g. {@code "GET / HTTP/1.0"}).
*/
@ConfigItem(defaultValue = "4096")
public int maxInitialLineLength;

}
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC
serverOptions.setTcpQuickAck(httpConfiguration.tcpQuickAck);
serverOptions.setTcpCork(httpConfiguration.tcpCork);
serverOptions.setTcpFastOpen(httpConfiguration.tcpFastOpen);
serverOptions.setMaxInitialLineLength(httpConfiguration.limits.maxInitialLineLength);

return serverOptions;
}
Expand Down Expand Up @@ -700,6 +701,7 @@ private static HttpServerOptions createHttpServerOptions(HttpConfiguration httpC
options.setTcpQuickAck(httpConfiguration.tcpQuickAck);
options.setTcpCork(httpConfiguration.tcpCork);
options.setTcpFastOpen(httpConfiguration.tcpFastOpen);
options.setMaxInitialLineLength(httpConfiguration.limits.maxInitialLineLength);
return options;
}

Expand Down

0 comments on commit 58032a0

Please sign in to comment.