=htc #17683 drop already consumed input in continue

This commit is contained in:
Johannes Rudolph 2015-06-08 14:59:00 +02:00
parent 8527e0347e
commit a26670a58e

View file

@ -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
}