[camel] branch master updated (840aa98 -> 8a242ab26)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch master updated (840aa98 -> 8a242ab26)

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

zregvart pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 840aa98  CAMEL-15098 - camel-3x-upgrade-guide-3_4.adoc malformed
     new f0d4577  CAMEL-15099: Set ssl to true for https URLs
     new bdbd8ed  CAMEL-15100: Use default SSLContext when keysto...
     new 8a242ab26 CAMEL-15101: header binding mismatch

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/netty/http/DefaultNettyHttpBinding.java       | 8 ++++----
 .../camel/component/netty/http/HttpClientInitializerFactory.java  | 4 +++-
 .../org/apache/camel/component/netty/http/NettyHttpComponent.java | 4 ++++
 3 files changed, 11 insertions(+), 5 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[camel] 01/03: CAMEL-15099: Set ssl to true for https URLs

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

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f0d45775ba42847883f54449d823e4e7478c032c
Author: Zoran Regvart <[hidden email]>
AuthorDate: Fri May 22 12:52:46 2020 +0200

    CAMEL-15099: Set ssl to true for https URLs
   
    This makes it easier to use the Netty HTTP producer with `https` URLs.
    Also provides symmetry with the behavior when used in the REST Producer
    contract.
---
 .../org/apache/camel/component/netty/http/NettyHttpComponent.java     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
index 92eb4ed..aae4ada 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java
@@ -228,6 +228,10 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt
         configuration.setProtocol("tcp");
         configuration.setTextline(false);
 
+        if ("https".equals(uri.getScheme())) {
+            configuration.setSsl(true);
+        }
+
         if (configuration instanceof NettyHttpConfiguration) {
             final NettyHttpConfiguration httpConfiguration = (NettyHttpConfiguration) configuration;
 

Reply | Threaded
Open this post in threaded view
|

[camel] 02/03: CAMEL-15100: Use default SSLContext when keysto...

zregvart
In reply to this post by zregvart
This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit bdbd8ed3b9821291436480d9f14ce022b759e439
Author: Zoran Regvart <[hidden email]>
AuthorDate: Fri May 22 12:54:18 2020 +0200

    CAMEL-15100: Use default SSLContext when keysto...
   
    ...re/trustore is not provided
   
    If there is no custom keystore or trustore configured, as file or as
    resource reference, this configures the SSLContext with the JVM
    defaults.
---
 .../camel/component/netty/http/HttpClientInitializerFactory.java      | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientInitializerFactory.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientInitializerFactory.java
index fd1bdbd..454da92 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientInitializerFactory.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/HttpClientInitializerFactory.java
@@ -163,7 +163,7 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
                         "file:" + configuration.getKeyStoreFile().getPath(),
                         "file:" + configuration.getTrustStoreFile().getPath(),
                         pw);
-            } else {
+            } else if (configuration.getKeyStoreResource() != null || configuration.getTrustStoreResource() != null) {
                 sslEngineFactory = new SSLEngineFactory();
                 answer = sslEngineFactory.createSSLContext(producer.getContext(),
                         configuration.getKeyStoreFormat(),
@@ -171,6 +171,8 @@ public class HttpClientInitializerFactory extends ClientInitializerFactory {
                         configuration.getKeyStoreResource(),
                         configuration.getTrustStoreResource(),
                         pw);
+            } else {
+                answer = SSLContext.getDefault();
             }
         }
 

Reply | Threaded
Open this post in threaded view
|

[camel] 03/03: CAMEL-15101: header binding mismatch

zregvart
In reply to this post by zregvart
This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8a242ab267fff4c2ca7aead7d7e37e7a8a814c57
Author: Zoran Regvart <[hidden email]>
AuthorDate: Fri May 22 12:58:12 2020 +0200

    CAMEL-15101: header binding mismatch
   
    This makes sure that the Camel message headers are bound correctly with
    respect to the URL given on the request. If using `https` scheme or
    configured with `ssl=true` when the port is not specified this sets the
    `Exchange.HTTP_PORT` to `433` instead of `80`; and when absolute URL is
    specified on the Netty `HttpRequest`, this makes sure that the
    `Exchange.HTTP_URL` contains that URL instead of concatenation of the
    URL from configuration and the URL from request.
---
 .../camel/component/netty/http/DefaultNettyHttpBinding.java       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
index c1b6ac6..20d18cf 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
@@ -150,9 +150,9 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
         // we want the full path for the url, as the client may provide the url in the HTTP headers as absolute or relative, eg
         //   /foo
         //   http://servername/foo
-        String http = configuration.isSsl() ? "https://" : "http://";
-        if (!s.startsWith(http)) {
-            if (configuration.getPort() != 80) {
+        if (!s.startsWith("http://") && !s.startsWith("https://")) {
+            String http = configuration.isSsl() ? "https://" : "http://";
+            if (configuration.getPort() != 80 && configuration.getPort() != 443) {
                 s = http + configuration.getHost() + ":" + configuration.getPort() + s;
             } else {
                 s = http + configuration.getHost() + s;
@@ -169,7 +169,7 @@ public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
         headers.put(Exchange.HTTP_SCHEME, uri.getScheme());
         headers.put(Exchange.HTTP_HOST, uri.getHost());
         final int port = uri.getPort();
-        headers.put(Exchange.HTTP_PORT, port > 0 ? port : 80);
+        headers.put(Exchange.HTTP_PORT, port > 0 ? port : configuration.isSsl() || "https".equals(uri.getScheme()) ? 443 : 80);
 
         // strip the starting endpoint path so the path is relative to the endpoint uri
         String path = uri.getRawPath();