diff --git a/akka-http-core/src/main/resources/reference.conf b/akka-http-core/src/main/resources/reference.conf index 2173c7ec21..4cd7e35465 100644 --- a/akka-http-core/src/main/resources/reference.conf +++ b/akka-http-core/src/main/resources/reference.conf @@ -196,10 +196,17 @@ akka.http { max-header-name-length = 64 max-header-value-length = 8k max-header-count = 64 - max-content-length = 8m max-chunk-ext-length = 256 max-chunk-size = 1m + # Maximum content length which should not be exceeded by incoming HttpRequests. + # For file uploads which use the entityBytes Source of an incoming HttpRequest it is safe to + # set this to a very high value (or to `infinite` if feeling very adventurous) as the streaming + # upload will be back-pressured properly by Akka Streams. + # Please note however that this setting is a global property, and is applied to all incoming requests, + # not only file uploads consumed in a streaming fashion, so pick this limit wisely. + max-content-length = 8m + # Sets the strictness mode for parsing request target URIs. # The following values are defined: # diff --git a/akka-http-core/src/main/scala/akka/http/ParserSettings.scala b/akka-http-core/src/main/scala/akka/http/ParserSettings.scala index 63e424b4b4..99b74b19a6 100644 --- a/akka-http-core/src/main/scala/akka/http/ParserSettings.scala +++ b/akka-http-core/src/main/scala/akka/http/ParserSettings.scala @@ -65,7 +65,7 @@ object ParserSettings extends SettingsCompanion[ParserSettings]("akka.http.parsi c getIntBytes "max-header-name-length", c getIntBytes "max-header-value-length", c getIntBytes "max-header-count", - c getBytes "max-content-length", + c getPossiblyInfiniteBytes "max-content-length", c getIntBytes "max-chunk-ext-length", c getIntBytes "max-chunk-size", Uri.ParsingMode(c getString "uri-parsing-mode"), diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/EnhancedConfig.scala b/akka-http-core/src/main/scala/akka/http/impl/util/EnhancedConfig.scala index 09cb967eea..6ba6263783 100644 --- a/akka-http-core/src/main/scala/akka/http/impl/util/EnhancedConfig.scala +++ b/akka-http-core/src/main/scala/akka/http/impl/util/EnhancedConfig.scala @@ -39,8 +39,8 @@ private[http] class EnhancedConfig(val underlying: Config) extends AnyVal { case x ⇒ getIntBytes(path) } - def getPossiblyInfiniteLongBytes(path: String): Long = underlying.getString(path) match { + def getPossiblyInfiniteBytes(path: String): Long = underlying.getString(path) match { case "infinite" ⇒ Long.MaxValue - case x ⇒ getIntBytes(path) + case x ⇒ underlying.getBytes(path) } }