Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
! can: add max-encryption-chunk-size setting to ClientConnectionSet…
Browse files Browse the repository at this point in the history
…tings and ServerSettings
  • Loading branch information
sirthias committed Oct 18, 2013
1 parent 5f23219 commit 0b5ef36
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
12 changes: 12 additions & 0 deletions spray-can/src/main/resources/reference.conf
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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)
}

Expand All @@ -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"))
Expand Down
Expand Up @@ -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") {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0b5ef36

Please sign in to comment.