gnodet-bot commented on code in PR #28265:
URL: https://github.com/apache/camel/pull/28265#discussion_r4360815684


##########
components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientConnection.java:
##########
@@ -99,6 +117,18 @@ public AS2ClientConnection(String as2Version, String 
userAgent, String clientFqd
                 sslContext != null ? "https" : "http",
                 ObjectHelper.notNull(targetHostName, "targetHostName"),
                 ObjectHelper.notNull(targetPortNumber, "targetPortNumber"));
+        if (proxyHost != null) {
+            // the connection to the proxy itself is plain http, whatever the 
target scheme: an https target is
+            // reached through a CONNECT tunnel
+            HttpHost proxy = new HttpHost("http", proxyHost, 
ObjectHelper.notNull(proxyPort, "proxyPort"));
+            this.route = new HttpRoute(targetHost, null, proxy, sslContext != 
null);
+            if (proxyAuthUsername != null && proxyAuthPassword != null) {

Review Comment:
   💡 **Usability:** If only one of `proxyAuthUsername`/`proxyAuthPassword` is 
provided, the `&&` condition is false and proxy authentication is silently 
skipped — the user gets no indication that their credentials were ignored. 
Consider adding a warning or failing early:
   
   ```java
   if (proxyAuthUsername != null && proxyAuthPassword != null) {
       this.proxyAuthorization = "Basic " + Base64.getEncoder().encodeToString(
               (proxyAuthUsername + ":" + 
proxyAuthPassword).getBytes(StandardCharsets.UTF_8));
   } else if (proxyAuthUsername != null || proxyAuthPassword != null) {
       LOG.warn("Proxy authentication requires both proxyAuthUsername and 
proxyAuthPassword; ignoring partial credentials");
   }
   ```



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