Skip to content

Commit

Permalink
Issue #6105 - HttpConnection.getBytesIn() incorrect for requests with…
Browse files Browse the repository at this point in the history
… chunked content

Fixed test that was too strictly comparing HttpConnection.bytesIn,
that now report a correct, but larger value.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Mar 26, 2021
1 parent 5f0bd97 commit 9e8309a
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -276,7 +276,8 @@ public long getLength()
assertThat("Request Input Content Received should have seen content", inputContentReceived.get(), greaterThan(0L));
assertThat("Request Input Content Received less then initial buffer", inputContentReceived.get(), lessThanOrEqualTo((long)sizeActuallySent));
assertThat("Request Connection BytesIn should have some minimal data", inputBytesIn.get(), greaterThanOrEqualTo(1024L));
assertThat("Request Connection BytesIn read should not have read all of the data", inputBytesIn.get(), lessThanOrEqualTo((long)sizeActuallySent));
long requestBytesSent = sizeActuallySent + 512; // Take into account headers and chunked metadata.
assertThat("Request Connection BytesIn read should not have read all of the data", inputBytesIn.get(), lessThanOrEqualTo(requestBytesSent));

// Now use the deferred content to complete writing of the request body content
contentProvider.offer(ByteBuffer.wrap(compressedRequest, sizeActuallySent, compressedRequest.length - sizeActuallySent));
Expand Down Expand Up @@ -395,7 +396,8 @@ public void onComplete(Request request)
assertThat("Request Input Content Received should have seen content", inputContentReceived.get(), greaterThan(0L));
assertThat("Request Input Content Received less then initial buffer", inputContentReceived.get(), lessThanOrEqualTo((long)sizeActuallySent));
assertThat("Request Connection BytesIn should have some minimal data", inputBytesIn.get(), greaterThanOrEqualTo(1024L));
assertThat("Request Connection BytesIn read should not have read all of the data", inputBytesIn.get(), lessThanOrEqualTo((long)sizeActuallySent));
long requestBytesSent = sizeActuallySent + 512; // Take into account headers and chunked metadata.
assertThat("Request Connection BytesIn read should not have read all of the data", inputBytesIn.get(), lessThanOrEqualTo(requestBytesSent));

// Now use the deferred content to complete writing of the request body content
contentProvider.offer(ByteBuffer.wrap(compressedRequest, sizeActuallySent, compressedRequest.length - sizeActuallySent));
Expand Down

0 comments on commit 9e8309a

Please sign in to comment.