seshuthota commented on code in PR #28362:
URL: https://github.com/apache/camel/pull/28362#discussion_r4369855033


##########
components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientConnection.java:
##########
@@ -279,16 +275,12 @@ public ClassicHttpResponse execute(ClassicHttpRequest 
request, HttpClientConnect
             }
         } finally {
             if (endpoint != null) {
+                // a null keep-alive makes the pool close the connection: a 
zero or negative one keeps it with no expiry
                 TimeValue keepAlive = null;
-                if (response != null) {
-                    // Normal happy path: release with computed keep-alive.
+                if (response != null && 
DefaultConnectionReuseStrategy.INSTANCE.keepAlive(request, response, 
httpContext)) {

Review Comment:
   Thanks, good catch. The body is now read in `send()` before the connection 
is released, and a connection whose body can't be read is closed rather than 
pooled. One adjustment: `BufferedHttpEntity` reports `isStreaming() == false`, 
which `EntityParser` rejects (16 `AS2MessageTest` cases failed), so the bytes 
go into a streaming `InputStreamEntity` that keeps the content type and 
encoding. Added tests for a 64 KB body, a chunked body, a truncated body and a 
stalled body. The 64 KB and chunked tests fail on the previous commit and pass 
now. Note the whole body is now held in memory before `send()` returns; the 
parser did that already.
   
   _Claude Code on behalf of @seshuthota_
   



-- 
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]

Reply via email to