From a26670a58e9410e57077400ec424014ea2ccfe50 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Mon, 8 Jun 2015 14:59:00 +0200 Subject: [PATCH] =htc #17683 drop already consumed input in `continue` --- .../akka/http/impl/engine/parsing/HttpMessageParser.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala b/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala index 03457828b1..b5bd371965 100644 --- a/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala +++ b/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala @@ -252,7 +252,9 @@ private[http] abstract class HttpMessageParser[Output >: MessageOutput <: Parser def continue(input: ByteString, offset: Int)(next: (ByteString, Int) ⇒ StateResult): StateResult = { state = math.signum(offset - input.length) match { - case -1 ⇒ more ⇒ next(input ++ more, offset) + case -1 ⇒ + val remaining = input.drop(offset) + (more ⇒ next(remaining ++ more, 0)) case 0 ⇒ next(_, 0) case 1 ⇒ throw new IllegalStateException }