Edward Welch created CAMEL-8518:
-----------------------------------

             Summary: Lack of url encoding of square braces [] in camel http 
component causes URISyntaxException
                 Key: CAMEL-8518
                 URL: https://issues.apache.org/jira/browse/CAMEL-8518
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.14.1
            Reporter: Edward Welch


I'm using camel as an HTTP proxy server for Kibana, when creating a new index 
in kibana, it uses a url that contains square braces:

http://localhost:5601/elasticsearch/.kibana/index-pattern/[logstash-]YYYY.MM.DD

This leads to a java.net.URISyntaxException in the HttpHelper class createURI 
method, on the first line where it tries to instantiate a URI.

I believe this may easily be fixed by adding square braces to the list of chars 
which need encoding in the UnsafeUriCharactersEncoder.encodeHttpURI method.  
This method is being called on line 215 of the HttpHelper class earlier in the 
processing.

Adding '[' and ']' to the static unsafeCharactersHttp initializer should cause 
those characters to be encoded and prevent this exception.

I see there is an unsafeCharactersRfc1738 set, which includes square braces, 
perhaps this could be used instead? I'm not sure the reason there are separate 
characters lists in this class.

Thanks,
Ed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to