Skip to content

Commit cf825f1

Browse files
committed
Update the pointer of Continuation's headerBuffer after copying the payload.
1 parent 306de8e commit cf825f1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,11 @@ void copyPayload(final ByteBuffer payload) {
13421342
if (payload == null) {
13431343
return;
13441344
}
1345-
headerBuffer.ensureCapacity(payload.remaining());
1346-
payload.get(headerBuffer.array(), headerBuffer.length(), payload.remaining());
1345+
int originalLength = headerBuffer.length();
1346+
int toCopy = payload.remaining();
1347+
headerBuffer.ensureCapacity(toCopy);
1348+
payload.get(headerBuffer.array(), originalLength, toCopy);
1349+
headerBuffer.setLength(originalLength + toCopy);
13471350
}
13481351

13491352
ByteBuffer getContent() {

0 commit comments

Comments
 (0)