seshuthota opened a new pull request, #28265:
URL: https://github.com/apache/camel/pull/28265

   _Claude Code on behalf of seshuthota_
   
   JIRA: [CAMEL-25941](https://issues.apache.org/jira/browse/CAMEL-25941)
   
   ## Description
   
   The AS2 client can't send through an HTTP proxy today. `AS2ClientConnection` 
drives `PoolingHttpClientConnectionManager` directly with `new 
HttpRoute(targetHost)`, so HttpClient's route planning never runs, the JVM 
`http(s).proxyHost` properties are ignored, and the startup test connection 
opens a raw socket straight to the partner.
   
   This PR adds four options to the AS2 client endpoint, with the same names 
and meaning as camel-http (same HttpClient 5 library):
   
   | Option | Notes |
   |---|---|
   | `proxyHost` | When not set, nothing changes. |
   | `proxyPort` | |
   | `proxyAuthUsername` | `security = "secret"`, optional Basic proxy auth |
   | `proxyAuthPassword` | `security = "secret"` |
   
   Behaviour:
   - **http target**: the request goes to the proxy in absolute form, with a 
preemptive `Proxy-Authorization` header when credentials are set.
   - **https target**: a CONNECT tunnel to the partner, then TLS over it 
through the connection manager's `upgrade()`, using the endpoint's 
`sslContext`. Hostname verification checks the partner's name, not the proxy's. 
`Proxy-Authorization` goes on the CONNECT request only and never reaches the 
partner.
   - The connection to the proxy is always plain HTTP, whatever the target 
scheme (the defaulting problem fixed in camel-http by CAMEL-24632).
   - A proxy refusal fails the send: a non-2xx CONNECT, or a 407 on the 
plain-http path.
   - The startup test connection checks the proxy instead of the partner when a 
proxy is set.
   - The existing `AS2ClientConnection` constructors keep their behaviour; a 
new constructor takes the proxy settings.
   
   Left out on purpose (see the ticket): asynchronous MDN delivery stays 
direct, because its address is chosen by the remote sender and routing it 
through the operator's proxy deserves its own discussion. Also not included: 
Digest/NTLM, `nonProxyHosts`, and CamelContext global proxy options.
   
   Documented in a new "Sending through an HTTP proxy" section of the AS2 
component page. Generated files (configurers, `as2.json`, catalog copies, 
`AS2EndpointBuilderFactory`) are regenerated. Because `AS2Configuration` is 
shared, the options also appear in the generated configurers of the server 
endpoint configurations, labelled `producer,proxy`, as other client-only 
options do.
   
   ## Tests
   
   - New `AS2ClientProxyTest` (10 tests) with a small in-test forward/CONNECT 
proxy (`TestHttpProxy`):
     - http through the proxy, and a partner hostname only the proxy can resolve
     - 407 over http and on CONNECT
     - https through the tunnel, checking no `Proxy-Authorization` reaches the 
partner
     - sequential and concurrent sends through the tunnel
     - hostname verification through the tunnel
     - an unreachable proxy fails at startup
     - a missing `proxyPort` gives a clear error
   - Mutation check: 11 hand-made mutants of the proxy code (no CONNECT, no TLS 
upgrade, origin-form request to the proxy, credentials leaked into the tunnel, 
CONNECT status ignored, and so on) are all caught by the tests.
   - Manually against a real Squid 6.13 with Basic auth:
     - all 23 `AS2MessageTest` cases (signed, encrypted, compressed, combined) 
over http and https
     - wrong passwords, and a partner only Squid can resolve
     - 20 sequential and 64 concurrent sends per protocol; https reused 8 
pooled tunnels
     - recovery after a Squid restart
   - Full camel-as2 build: 104 (api) + 23 (component, 1 skipped as before) + 
111 (integration) tests pass. Formatter and impsort applied.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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