[ 
https://issues.apache.org/jira/browse/CAMEL-17773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-17773:
--------------------------------
    Fix Version/s: 3.14.3

> camel-http: HttpSendDynamicAware parse uri incroectly if there are empty path 
> and get parametrs in uri
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-17773
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17773
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 3.x
>            Reporter: Artem St
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.14.3, 3.16.0
>
>         Attachments: HttpProducerGetRequestTest.java, 
> HttpSendDynamicAwareWithEmptyPathTest.java
>
>
> There is a simple example from the http component documentation, but 
> configured to use HttpSendDynamicAware:
> {code:java}
> from("direct:start")
>    .toD("http://oldhost?order=123&detail=short";);{code}
> Sending exchange to a direct:start will return an exception:
> {code:java}
> Failed to resolve endpoint: http://http://oldhost due to: Failed to resolve 
> endpoint: http://http://oldhost due to: The uri part is not configured 
> correctly. You have duplicated the http(s) protocol.{code}
>  
> I belive, the core of the problem is how HttpSendDynamicAware parses uri. 
> it's keeps scheme of uri if there is empty path. For example this test will 
> not return the expected result:
> {code:java}
> @Test
> public void testHttpsUndefinedPortParseUri() {
>    this.httpSendDynamicAware.setScheme("https");
>    DynamicAwareEntry entry = new DynamicAwareEntry("https://localhost:80/";, 
> null, null, null);
>    String[] result = httpSendDynamicAware.parseUri(entry);
>    assertEquals("localhost", result[0], "Parse should not add port if https 
> and not specified");
> }{code}
> {code:java}
> org.opentest4j.AssertionFailedError: Parse should not add port if https and 
> not specified ==> 
> Expected :localhost
> Actual   :https://localhost:80/{code}
> Both test classes are attached.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to