Diff

util/dbuffer.lua @ 11045:8c6bace13229

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.
author Matthew Wild <mwild1@gmail.com>
date Mon, 24 Aug 2020 16:18:13 +0100
parent 11028:d7a403060946
child 11114:6a608ecb3471
line wrap: on
line diff
--- a/util/dbuffer.lua	Mon Aug 24 17:07:37 2020 +0200
+++ b/util/dbuffer.lua	Mon Aug 24 16:18:13 2020 +0100
@@ -123,7 +123,7 @@
 
 	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)