Andrea Cosentino created CAMEL-26826:
----------------------------------------

             Summary: camel-opa - bound REST response body reading by the 
request deadline
                 Key: CAMEL-26826
                 URL: https://issues.apache.org/jira/browse/CAMEL-26826
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


h2. Problem / motivation
OpaHttpClient.send uses BodyHandlers.ofInputStream. The response becomes 
available before body completion, leaving subsequent SDK body reading outside 
the configured request deadline. An isolated Java 21 transport check with a 
200ms timeout remained blocked after 800ms when headers and a partial body 
arrived promptly.

h2. Proposed scope
Enforce a deadline through complete response consumption and cancel/close 
incomplete responses. Keep normal denial, evaluation error and 
unavailable-decision handling distinct. Ensure SDK retries do not accidentally 
defeat the documented total wait semantics.

h2. Acceptance criteria / validation
* Regression test: headers arrive promptly, body stalls.
* Cover no headers, partial/truncated JSON, interruption and successful 
completion.
* Verify the configured deadline and cleanup on the supported JDKs; update 
timeout documentation.

h2. References
* 
https://github.com/apache/camel/blob/5686684cb418/components/camel-opa/src/main/java/org/apache/camel/component/opa/OpaHttpClient.java#L78
* 
https://github.com/apache/camel/blob/5686684cb418/components/camel-opa/src/test/java/org/apache/camel/component/opa/OpaRestTransportTest.java
* 
https://docs.oracle.com/en/java/javase/21/docs/api/java.net.http/java/net/http/HttpResponse.BodyHandlers.html#ofInputStream()

h2. Context
Follow-up to CAMEL-24784; that resolved ticket introduced transport timeouts, 
while this issue covers the remaining body-consumption phase. Not a duplicate 
of the original pre-header timeout coverage.

Source: read-only component audit at 5686684cb418. Recheck current main before 
implementing; historical references identify the audited code.

_AI-generated by Codex on behalf of oscerd (JIRA: acosentino)._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to