Permalink
Browse files

! can: add `max-encryption-chunk-size` setting to ClientConnectionSet…

…tings and ServerSettings
  • Loading branch information...
sirthias committed Oct 16, 2013
1 parent 5f23219 commit 0b5ef3693f62b4c72da7b77f7ede816a697408d1
@@ -120,6 +120,12 @@ spray.can {
# doesn't have to be fiddled with in most applications.
response-header-size-hint = 512
+ # For HTTPS connections this setting specified the maximum number of
+ # bytes that are encrypted in one go. Large responses are broken down in
+ # chunks of this size so as to already begin sending before the response has
+ # been encrypted entirely.
+ max-encryption-chunk-size = 1m
+
# The time period within which the TCP binding process must be completed.
# Set to `infinite` to disable.
bind-timeout = 1s
@@ -210,6 +216,12 @@ spray.can {
# doesn't have to be fiddled with in most applications.
request-header-size-hint = 512
+ # For HTTPS connections this setting specified the maximum number of
+ # bytes that are encrypted in one go. Large requests are broken down in
+ # chunks of this size so as to already begin sending before the request has
+ # been encrypted entirely.
+ max-encryption-chunk-size = 1m
+
# The time period within which the TCP connecting process must be completed.
# Set to `infinite` to disable.
connecting-timeout = 10s
@@ -30,17 +30,17 @@ case class ClientConnectionSettings(
responseChunkAggregationLimit: Int,
chunklessStreaming: Boolean,
requestHeaderSizeHint: Int,
+ maxEncryptionChunkSize: Int,
connectingTimeout: Duration,
parserSettings: ParserSettings,
proxySettings: Map[String, ProxySettings]) {
requirePositive(idleTimeout)
requirePositive(requestTimeout)
requirePositive(reapingCycle)
- require(0 <= responseChunkAggregationLimit && responseChunkAggregationLimit <= Int.MaxValue,
- "response-chunk-aggregation-limit must be >= 0 and <= Int.MaxValue")
- require(0 <= requestHeaderSizeHint && requestHeaderSizeHint <= Int.MaxValue,
- "request-size-hint must be >= 0 and <= Int.MaxValue")
+ require(0 <= responseChunkAggregationLimit, "response-chunk-aggregation-limit must be >= 0")
+ require(0 < requestHeaderSizeHint, "request-size-hint must be > 0")
+ require(0 < maxEncryptionChunkSize, "max-encryption-chunk-size must be > 0")
requirePositive(connectingTimeout)
}
@@ -59,6 +59,7 @@ object ClientConnectionSettings extends SettingsCompanion[ClientConnectionSettin
c getBytes "response-chunk-aggregation-limit" toInt,
c getBoolean "chunkless-streaming",
c getBytes "request-header-size-hint" toInt,
+ c getBytes "max-encryption-chunk-size" toInt,
c getDuration "connecting-timeout",
ParserSettings fromSubConfig c.getConfig("parsing"),
ProxySettings fromSubConfig c.getConfig("proxy"))
@@ -41,16 +41,16 @@ case class ServerSettings(
verboseErrorMessages: Boolean,
requestChunkAggregationLimit: Int,
responseHeaderSizeHint: Int,
+ maxEncryptionChunkSize: Int,
defaultHostHeader: Host,
backpressureSettings: Option[BackpressureSettings],
parserSettings: ParserSettings) {
requirePositive(reapingCycle)
require(0 <= pipeliningLimit && pipeliningLimit <= 128, "pipelining-limit must be >= 0 and <= 128")
- require(0 <= requestChunkAggregationLimit && requestChunkAggregationLimit <= Int.MaxValue,
- "request-chunk-aggregation-limit must be >= 0 and <= Int.MaxValue")
- require(0 <= responseHeaderSizeHint && responseHeaderSizeHint <= Int.MaxValue,
- "response-size-hint must be >= 0 and <= Int.MaxValue")
+ require(0 <= requestChunkAggregationLimit, "request-chunk-aggregation-limit must be >= 0")
+ require(0 <= responseHeaderSizeHint, "response-size-hint must be > 0")
+ require(0 < maxEncryptionChunkSize, "max-encryption-chunk-size must be > 0")
}
object ServerSettings extends SettingsCompanion[ServerSettings]("spray.can.server") {
@@ -96,6 +96,7 @@ object ServerSettings extends SettingsCompanion[ServerSettings]("spray.can.serve
c getBoolean "verbose-error-messages",
c getBytes "request-chunk-aggregation-limit" toInt,
c getBytes "response-header-size-hint" toInt,
+ c getBytes "max-encryption-chunk-size" toInt,
defaultHostHeader =
HttpParser.parseHeader(RawHeader("Host", c getString "default-host-header")) match {
case Right(x: Host) x

0 comments on commit 0b5ef36

Please sign in to comment.