AlwaysPS opened a new issue, #1549: URL: https://github.com/apache/httpcomponents-core/issues/1549
In Apache HttpCore 5.5, a caller copying a response body with response.getEntity().writeTo(output) can receive a normal return even when the copy failed. If some bytes have already been written, the caller has no indication from writeTo that the output is incomplete. This report is based on the 5.5 source. HttpRequester.execute wraps the response entity and delegates the copy to the wrapped entity. If the copy throws IOException, the wrapper catches it, calls abortConnection() to discard the connection, and reaches the end of writeTo without propagating the exception. HttpEntity.writeTo documents IOException for an I/O error. The wrapper should discard the failed connection and propagate the original exception to the caller. A regression test could use an output stream that throws a known IOException and check that the caller receives that exception and that the connection is discarded. Response wrapper in HttpCore 5.5 https://github.com/apache/httpcomponents-core/blob/4edc2fbeebe00eccb8818889b151aaa65573d21b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java#L397-L407 HttpEntity.writeTo contract in the same release https://github.com/apache/httpcomponents-core/blob/4edc2fbeebe00eccb8818889b151aaa65573d21b/httpcore5/src/main/java/org/apache/hc/core5/http/HttpEntity.java#L115-L123 This report was drafted with AI assistance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
