Skip to content

Commit

Permalink
Set MaxInitialLineSize from maxInitialSizeKB config
Browse files Browse the repository at this point in the history
MaxInitialLineSize parameter is not set from the config. This appears to
be a regression in 1.7.x

This commit adds test case to demonstrate the issue and a fix

Fixes linkerd#2393

Signed-off-by: Dmytro Kostiuchenko <edio@archlinux.us>
  • Loading branch information
koiuo committed May 27, 2020
1 parent 3b314a6 commit 4efc5f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ case class HttpConfig(
.maybeWith(httpAccessLogAppend.map(AccessLogger.param.Append.apply))
.maybeWith(httpAccessLogRotateCount.map(AccessLogger.param.RotateCount.apply))
.maybeWith(maxHeadersKB.map(kb => hparam.MaxHeaderSize(kb.kilobytes)))
.maybeWith(maxInitialLineKB.map(kb => hparam.MaxInitialLineSize(kb.kilobytes)))
.maybeWith(streamAfterContentLengthKB.map(kb => hparam.FixedLengthStreamedAfter(kb.kilobytes)))
.maybeWith(Some(streaming))
.maybeWith(Some(hparam.MaxRequestSize(MaxReqRespSize)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package io.buoyant.linkerd.protocol.http

import com.fasterxml.jackson.databind.exc.InvalidDefinitionException
import com.twitter.finagle.buoyant.Dst
import com.twitter.finagle.http.param.Streaming
import com.twitter.finagle.http.param.{MaxInitialLineSize, Streaming}
import com.twitter.finagle.http.{Method, Request}
import com.twitter.finagle.{Dtab, Path, Stack}
import com.twitter.conversions.StorageUnitOps._
import com.twitter.util.Future
import io.buoyant.config.Parser
import io.buoyant.linkerd.protocol.{HttpConfig, HttpIdentifierConfig, HttpInitializer}
Expand All @@ -14,7 +15,6 @@ import io.buoyant.router.RoutingFactory.{IdentifiedRequest, Identifier}
import io.buoyant.router.http.TimestampHeaderFilter
import io.buoyant.test.{Awaits, FunSuite}


class HttpConfigTest extends FunSuite with Awaits {

def parse(yaml: String): HttpConfig = {
Expand Down Expand Up @@ -102,6 +102,21 @@ class HttpConfigTest extends FunSuite with Awaits {
assert(streaming.enabled)
}

test("Issue #2393 - MaxInitialLineSize set from config") {
val yaml = s"""
|protocol: http
|identifier:
| kind: io.l5d.methodAndHost
|maxInitialLineKB: 64
|servers:
|- port: 5000
""".stripMargin
val config = parse(yaml)

val maxInitialLineKB = config.routerParams(Stack.Params.empty)[MaxInitialLineSize]
assert(maxInitialLineKB.size == 64.kilobytes)
}

test("ConfigErrorTest - Stream disabled, streamAfter Set") {
val yaml = s"""
|protocol: http
Expand Down

0 comments on commit 4efc5f5

Please sign in to comment.