Skip to content

Commit

Permalink
Allow setting size limit on line and header length
Browse files Browse the repository at this point in the history
There was a slight difference in behavior between series/3.x and series/2.x
where the old one's default values on lengths were higher.
Those requests were marked as invalid.
Now, the value is configurable.
  • Loading branch information
peel committed Mar 26, 2024
1 parent 63aea42 commit 150ca95
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 7 deletions.
2 changes: 2 additions & 0 deletions core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
idleTimeout = 610 seconds
responseHeaderTimeout = 2 seconds
bodyReadTimeout = 500 millis
maxRequestLineLength = 20480
maxHeadersLength = 40960
}

debug {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ object Config {
maxConnections: Int,
idleTimeout: FiniteDuration,
responseHeaderTimeout: FiniteDuration,
bodyReadTimeout: FiniteDuration
bodyReadTimeout: FiniteDuration,
maxRequestLineLength: Int,
maxHeadersLength: Int
)

case class License(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ object HttpServer {
.withIdleTimeout(networking.idleTimeout)
.withMaxConnections(networking.maxConnections)
.withResponseHeaderTimeout(networking.responseHeaderTimeout)
.withLengthLimits(
maxRequestLineLen = networking.maxRequestLineLength,
maxHeadersLen = networking.maxHeadersLength
)
.cond(secure, _.withSslContext(SSLContext.getDefault))
.resource

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ object TestUtils {
1024,
610.seconds,
2.second,
500.millis
500.millis,
20480,
40960
),
debug = Debug.Debug(
http = Debug.Http(enable = false, logHeaders = true, logBody = false, redactHeaders = List.empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ object KafkaConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 2.seconds,
bodyReadTimeout = 500.millis
bodyReadTimeout = 500.millis,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
license = Config.License(accept = true),
debug = Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ object KinesisConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 2.seconds,
bodyReadTimeout = 500.millis
bodyReadTimeout = 500.millis,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
streams = Config.Streams(
useIpAddressAsPartitionKey = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ object NsqConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 2.seconds,
bodyReadTimeout = 500.millis
bodyReadTimeout = 500.millis,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
license = Config.License(accept = true),
debug = Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ object ConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 2.seconds,
bodyReadTimeout = 500.millis
bodyReadTimeout = 500.millis,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
streams = Config.Streams(
useIpAddressAsPartitionKey = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ object SqsConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 2.seconds,
bodyReadTimeout = 500.millis
bodyReadTimeout = 500.millis,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
streams = Config.Streams(
useIpAddressAsPartitionKey = false,
Expand Down

0 comments on commit 150ca95

Please sign in to comment.