Comparison

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
comparison
equal deleted inserted replaced
11044:7b720a815519 11045:8c6bace13229
121 return ""; 121 return "";
122 end 122 end
123 123
124 self:collapse(j); 124 self:collapse(j);
125 125
126 return self.items:peek():sub(i, j); 126 return self.items:peek():sub(self.front_consumed+1):sub(i, j);
127 end 127 end
128 128
129 function dbuffer_methods:byte(i, j) 129 function dbuffer_methods:byte(i, j)
130 i = i or 1; 130 i = i or 1;
131 j = j or i; 131 j = j or i;