Quantcast

URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
Hi all,
I am migrating my application from Camel 2.8.2 to Camel 2.10.0 and found following issue:

when normalizing a uri with URISupport.normalizeUri which contains %26 in one of its parameters the entity is transformed to '&' and essentially lost from the parameter value; this was not happening with camel 2.8.2.

for instance normalizing following URL: "ftp://user@host/doveci?password=pass%26"

with camel 2.10.0 the result is following:
"ftp://user@host/doveci?&password=pass"

with camel 2.8.2 the result is following:
"ftp://user@host/doveci?password=pass%26"

it looks like in camel 2.10.0 '%26' is decoded to '&' and moved at the very beginning of the string (possibly because camel thinks it is a parameter named null string) resulting in an invalid Uri.

is there any way to workaround/fix this? I can't force all my customers to avoid using & on their passwords.


Thank you,
Marco

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
can you please let me know if this is how it should work and therefore camel 2.8.2 was buggy?
I just need to know if I have to find a workaround until a bugfix is release or instead I am implementing it in the wrong way.

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

hekonsek
In reply to this post by Marco Crivellaro
Hi,

> when normalizing a uri with URISupport.normalizeUri which contains %26 in
> one of its parameters the entity is transformed to '&' and essentially lost
> from the parameter value;

Yes, this is bug.

And actually it is not so easy to fix, since due to some hacks (like
CAMEL-4954) that exists in the URISupport. :(

I'm don't even know how to provide a workaround for it. Somebody
should take a closer look at it since now using %26 in endpoint
parameters generate a problems.

I'll try to analyze it and fix in the next week, but I can't promise
that I'll manage to do it. In the meantime I created the issue [1] for
it.

Best regards.

[1] https://issues.apache.org/jira/browse/CAMEL-5484

--
Henryk Konsek
http://henryk-konsek.blogspot.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
thank you Henryk.
I saw you planned to fix it for Camel 2.11.0; is there a chance to have in 2.10 too since it is a major bug?

Marco
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

hekonsek
> I saw you planned to fix it for Camel 2.11.0; is there a chance to have in
> 2.10 too since it is a major bug?

Yeah, I think that patch will be applied to 2.10 as well :) . But
first somebody need to nail the bug and provide the fix.

--
Henryk Konsek
http://henryk-konsek.blogspot.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

hekonsek
In reply to this post by Marco Crivellaro
> since it is a major bug?

Ok. The good news is that I got a workaround for you :) .

Create the component without the FTP password defined in the
parameters and then programatically set it on the endpoint.

final String uri = "ftp://user@host/doveci";
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new RouteBuilder() {
  @Override
  public void configure() throws Exception {
    from(uri).to("log:OUT");
  }
});
camelContext.getEndpoint(uri,
FtpEndpoint.class).getConfiguration().setPassword("pass%26");

Since password passed this way is not a part of the endpoint URI, it
will be not normalized by the buggy code.

Laters.

--
Henryk Konsek
http://henryk-konsek.blogspot.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
hekonsek wrote
Ok. The good news is that I got a workaround for you :) .

Create the component without the FTP password defined in the
parameters and then programatically set it on the endpoint.
I wish it was this easy... unfortunately our architecture is build around the endpoint uris (a third component provides the URIs), it is very difficult to apply your workaround (which is smart I have to say).
I'll see if I can apply it using interceptors (which we already use to set filename).

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

hekonsek
> unfortunately our architecture is build around
> the endpoint uris (a third component provides the URIs), it is very
> difficult to apply your workaround (which is smart I have to say).

Maybe I'll figure out another way around your problem :) .

--
Henryk Konsek
http://henryk-konsek.blogspot.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

hadrian
In reply to this post by Marco Crivellaro
Would using properties be acceptable as a solution (including
camel-jasypt maybe if you don't want the pwd in clear)?

Hadrian

On 08/06/2012 07:34 AM, Marco Crivellaro wrote:

>
> hekonsek wrote
>>
>> Ok. The good news is that I got a workaround for you :) .
>>
>> Create the component without the FTP password defined in the
>> parameters and then programatically set it on the endpoint.
>>
>
> I wish it was this easy... unfortunately our architecture is build around
> the endpoint uris (a third component provides the URIs), it is very
> difficult to apply your workaround (which is smart I have to say).
> I'll see if I can apply it using interceptors (which we already use to set
> filename).
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/URISupport-normalizeUri-different-result-from-camel-2-8-2-to-2-10-0-tp5716633p5716877.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
hadrian wrote
Would using properties be acceptable as a solution (including
camel-jasypt maybe if you don't want the pwd in clear)?

Hadrian
No sure what you mean, would it be possible for you to provide an example?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
In reply to this post by hadrian
hadrian wrote
Would using properties be acceptable as a solution (including
camel-jasypt maybe if you don't want the pwd in clear)?

Hadrian
Hi Hadrian,
unfortunately I can't use properties without re engineering the whole application. we manage hundreds of endpoints centrally and the list is growing constantly. Furthermore, our component makes use of recipientList
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: URISupport.normalizeUri different result from camel 2.8.2 to 2.10.0

Marco Crivellaro
In reply to this post by Marco Crivellaro
Unfortunately interceptors cannot be used. We use a recipientList in our route and password cannot be set in a header like filename... really need this to be fixed.
Loading...