From 7fa4cc8de0ffb0a0914c1861987a19cf666febf6 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 24 Aug 2020 16:18:13 +0100 Subject: util.dbuffer: Fix :sub() not working with partially-consumed chunks (thanks Zash for test case) This also appears to fix some bugs with chunk-encoded streams in net.http.parser. --- util/dbuffer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/dbuffer.lua b/util/dbuffer.lua index 9ec40eb9..a50f3a64 100644 --- a/util/dbuffer.lua +++ b/util/dbuffer.lua @@ -123,7 +123,7 @@ function dbuffer_methods:sub(i, j) self:collapse(j); - return self.items:peek():sub(i, j); + return self.items:peek():sub(self.front_consumed+1):sub(i, j); end function dbuffer_methods:byte(i, j) -- cgit v1.2.3