camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: DefaultComponent - Validating URI
Date Tue, 18 Nov 2008 14:27:05 GMT
It is easy to find if there are duplicate '?' characters in the URI
string. (Just one if statement in the DefaultComponent.validateURI() method)
BTW, there are already some check points in the valiateURI(), we could
add more if we need.

Just my 2 cents.

Willem

Claus Ibsen wrote:
> Hi
> 
> Actually I only disconvered it as I was running a unit test that
> expected it to be "true" but it was "true?ddd=xxx"
> 
> And end user could by mistake add parameters that he think are
> seperated but is acutally only one parameter but since the type maybe
> is a string then its true?ddd=xxx and not two parameters with types
> of: boolean and string.
> 
> But since it's a valid URI then we can't get any help there. But maybe
> have a WARN logging for stuff that really looks as invalid parameters
> such as have duplicate ? chars.
> 
> Are anyone familiar with other frameworks that is URI based and how
> they handle such a problem?
> 
> I am using IDEA that is a clever editor and it doesn't give me a hint
> that the URI is probably wrong. So I doubt that tooling is helping out
> much.
> 
> 
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
> 
> 
> 
> On Tue, Nov 18, 2008 at 2:08 PM, Hadrian Zbarcea <hzbarcea@gmail.com> wrote:
>> What about other invalid characters?  We don't need extra validation imho.
>>  Claus figured out pretty quickly what was wrong. I would assume other users
>> won't have a hard time with what Camel offers already.  I'd like to keep
>> Camel lean.
>>
>> What I would like to see though is more tools.  Those *should* validate as
>> well as possible that a url is correct.
>>
>> My $0.02,
>> Hadrian
>>
>> On Nov 18, 2008, at 7:55 AM, Jon Anstey wrote:
>>
>>> Good point Hadrian. Also maybe somebody out there is depending on this
>>> functionality? Maybe we could just log a warning if we see a second '?'
>>>
>>> On Tue, Nov 18, 2008 at 3:07 AM, Hadrian Zbarcea <hzbarcea@gmail.com>
>>> wrote:
>>>
>>>> My personal preference would be to not add extra validation.  The main
>>>> reason is that there are quite a few other characters that are not
>>>> allowed
>>>> either ('=' for instance) and in the general case url (semantical)
>>>> validation is not an easy thing to do (i.e. the benefit would be quite
>>>> limited imho).  The url parser did the right thing, and I think we could
>>>> rely on developers testing their apps and make sure that the url they
>>>> pass
>>>> is indeed the intended one.
>>>>
>>>> So a non-binding -1 from me.
>>>>
>>>> Cheers
>>>> Hadrian
>>>>
>>>>
>>>>
>>>> On Nov 16, 2008, at 9:23 AM, Claus Ibsen wrote:
>>>>
>>>> Hi
>>>>> I was messing CAMEL-1096 for camel-mail and I mistyped the URI adding
>>>>> a 2nd ? char in the URI string.
>>>>> However this one passes the validation. I was wondering if that normal?
>>>>>
>>>>> eg:
>>>>> pop3://localhost?username=james&mail.pop3.forgettopheaders=true?ddd=sss
>>>>>
>>>>> Would validate into 2 parameters
>>>>> username=james
>>>>> mail.pop3.forgettopheaders=true?ddd=sss
>>>>>
>>>>> So the 2nd parameter value is: true?ddd=sss
>>>>>
>>>>> I was wondering if we should add some validation that a 2nd ? is not
>>>>> allowed in the URI string?
>>>>>
>>>>>
>>>>> /Claus Ibsen
>>>>> Apache Camel Committer
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>
>>>>
>>>
>>> --
>>> Cheers,
>>> Jon
>>>
>>> http://janstey.blogspot.com/
>>
> 


Mime
View raw message