From c611f716bd424ea1971791fddaac1b45cbe8c3c3 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Tue, 6 Feb 2018 10:31:03 -0500 Subject: [PATCH] stay in sync with multiple requests --- http2.d | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/http2.d b/http2.d index 041cc1f..d96b7c2 100644 --- a/http2.d +++ b/http2.d @@ -925,8 +925,12 @@ class HttpRequest { // responseData.content ~= cast(ubyte[]) uncompress.uncompress(data); //else responseData.content ~= data; - assert(data.length <= bodyReadingState.contentLengthRemaining, format("%d <= %d\n%s", data.length, bodyReadingState.contentLengthRemaining, cast(string)data)); - bodyReadingState.contentLengthRemaining -= data.length; + //assert(data.length <= bodyReadingState.contentLengthRemaining, format("%d <= %d\n%s", data.length, bodyReadingState.contentLengthRemaining, cast(string)data)); + int use = cast(int) data.length; + if(use > bodyReadingState.contentLengthRemaining) + use = bodyReadingState.contentLengthRemaining; + bodyReadingState.contentLengthRemaining -= use; + data = data[use .. $]; if(bodyReadingState.contentLengthRemaining == 0) { if(bodyReadingState.isGzipped || bodyReadingState.isDeflated) { auto n = uncompress.uncompress(responseData.content);