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 2022/09/23 08:24:09 UTC

[camel] branch main updated: CAMEL-18544: camel-http - ToD optimized context-path with spaces problem

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 86e6b005e9f CAMEL-18544: camel-http - ToD optimized context-path with spaces problem
86e6b005e9f is described below

commit 86e6b005e9f9f415666a738be622f1c1817c287a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Sep 23 10:22:26 2022 +0200

    CAMEL-18544: camel-http - ToD optimized context-path with spaces problem
---
 .../main/java/org/apache/camel/http/base/HttpSendDynamicAware.java    | 4 +++-
 .../camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java   | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java b/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java
index e476bc923c7..97efdc2934c 100644
--- a/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java
+++ b/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java
@@ -28,6 +28,7 @@ import org.apache.camel.support.component.SendDynamicAwareSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StringHelper;
 import org.apache.camel.util.URISupport;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
 
 /**
  * HTTP based {@link org.apache.camel.spi.SendDynamicAware} which allows to optimise HTTP components with the toD
@@ -163,8 +164,9 @@ public class HttpSendDynamicAware extends SendDynamicAwareSupport {
             }
         }
 
-        // favour using java.net.URI for parsing into host, context-path and authority
         try {
+            // favour using java.net.URI for parsing into host, context-path and authority
+            u = UnsafeUriCharactersEncoder.encode(u);
             URI parse = new URI(u);
             String host = parse.getHost();
             String path = parse.getPath();
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java
index c6b42f34ed1..e5c49143887 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithSpacesTest.java
@@ -28,13 +28,11 @@ import org.apache.http.impl.bootstrap.HttpServer;
 import org.apache.http.impl.bootstrap.ServerBootstrap;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-@Disabled("https://issues.apache.org/jira/browse/CAMEL-18544")
 public class HttpSendDynamicAwareUriWithSpacesTest extends BaseHttpTest {
 
     private HttpServer localServer;