This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new a81efd9 CAMEL-15012: camel-http - Support using proxyHost,proxyPort
parameters.
a81efd9 is described below
commit a81efd947b0fd64a5ef5a4360e4f9552ad678deb
Author: Claus Ibsen <[email protected]>
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();
}