This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 115972639478994e39e5d2fb5f5a2c4d22b8c2ac Author: Claus Ibsen <[email protected]> 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;
