You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/08/07 07:14:32 UTC

[camel] branch camel-3.4.x updated: CAMEL-15012: camel-http - Support using proxyHost, proxyPort parameters.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.4.x by this push:
     new 12cf9dd  CAMEL-15012: camel-http - Support using proxyHost,proxyPort parameters.
12cf9dd is described below

commit 12cf9dd9ab1af4ed11815cf7371d619eb51c0c91
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 7 09:13:23 2020 +0200

    CAMEL-15012: camel-http - Support using proxyHost,proxyPort parameters.
---
 .../main/java/org/apache/camel/component/http/HttpComponent.java | 9 +++++++++
 .../org/apache/camel/component/http/HttpProxyServerTest.java     | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
index 28255bd..64a931c 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
@@ -184,6 +184,13 @@ public class HttpComponent extends HttpCommonComponent implements RestProducerFa
         }
         String proxyAuthHost = getParameter(parameters, "proxyAuthHost", String.class);
         Integer proxyAuthPort = getParameter(parameters, "proxyAuthPort", Integer.class);
+        // fallback to alternative option name
+        if (proxyAuthHost == null) {
+            proxyAuthHost = getParameter(parameters, "proxyHost", String.class);
+        }
+        if (proxyAuthPort == null) {
+            proxyAuthPort = getParameter(parameters, "proxyPort", Integer.class);
+        }
 
         if (proxyAuthHost != null && proxyAuthPort != null) {
             String proxyAuthUsername = getParameter(parameters, "proxyAuthUsername", String.class);
@@ -191,6 +198,8 @@ public class HttpComponent extends HttpCommonComponent implements RestProducerFa
             String proxyAuthDomain = getParameter(parameters, "proxyAuthDomain", String.class);
             String proxyAuthNtHost = getParameter(parameters, "proxyAuthNtHost", String.class);
 
+            LOG.debug("Configuring HTTP client to use HTTP proxy {}:{}", proxyAuthHost, proxyAuthPort);
+
             if (proxyAuthUsername != null && proxyAuthPassword != null) {
                 return CompositeHttpConfigurer.combineConfigurers(
                     configurer, new ProxyHttpClientConfigurer(proxyAuthHost, proxyAuthPort, proxyAuthScheme, proxyAuthUsername, proxyAuthPassword, proxyAuthDomain, proxyAuthNtHost));
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyServerTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyServerTest.java
index 3589e63..bd2c5be 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyServerTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpProxyServerTest.java
@@ -113,6 +113,15 @@ public class HttpProxyServerTest extends BaseHttpTest {
         assertExchange(exchange);
     }
 
+    @Test
+    public void httpGetWithProxyAndWithoutUserTwo() throws Exception {
+
+        Exchange exchange = template.request("http://" + getProxyHost() + ":" + getProxyPort() + "?proxyHost=" + getProxyHost() + "&proxyPort=" + getProxyPort(), exchange1 -> {
+        });
+
+        assertExchange(exchange);
+    }
+
     private String getProxyHost() {
         return proxy.getInetAddress().getHostName();
     }