File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
protocol/src/main/java/org/threadly/litesockets/protocols/http/request Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,10 @@ private boolean parseChunkData() {
265265 sendDuplicateBBtoListeners (chunkedBB );
266266 int remaining = Math .min (((int )bodySize ) - currentBodySize , MAX_CHUNK_SIZE );
267267 if (remaining > 0 ) {
268- chunkedBB = ByteBuffer .allocate (remaining );
268+ chunkedBB .clear ();
269+ if (remaining < chunkedBB .capacity ()) {
270+ chunkedBB .limit (remaining );
271+ } // it should not be possible for remaining to be larger than the buffer size
269272 } else {
270273 chunkedBB = null ;
271274 }
@@ -306,7 +309,10 @@ public void reset(Throwable t) {
306309 this .request = null ;
307310 this .currentBodySize = 0 ;
308311 this .bodySize = 0 ;
309- this .isChunked = false ;
312+ if (isChunked ) {
313+ isChunked = false ;
314+ chunkedBB = null ;
315+ }
310316 }
311317
312318 /**
You can’t perform that action at this time.
0 commit comments