[ 
https://issues.apache.org/jira/browse/VALIDATOR-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540604
 ] 

Ben Speakmon commented on VALIDATOR-248:
----------------------------------------

Assuming that we're talking about the new UrlValidator/DomainValidator in the 
routines package, since they're new classes we're not constrained by the 
behavior of the old implementations in the validator package. The plan is to 
deprecate the ones in validator, so I doubt we'll be adding new features to 
them or changing their behavior.

To be clear, I'm opposed to changing DomainValidator to allow non-IANA TLDs 
because that obviates the point of domain validation, even if you have a list 
of unofficial TLDs you want to approve. So the discussion is then about what 
changes we make to UrlValidator. I think there are three things to consider:

1) Not supporting localhost is a bug per RFC2396; we should enable it by 
default and provide an option to turn it off. That's this JIRA issue.
2) Supporting random machine names, e.g., http://mymachine/testapp/test.jsp. I 
imagine this would be an option that allows you to specify what machine names 
are acceptable; I don't want to just allow anything in there, since what's the 
point of validating if you do? This should be opened as a separate issue (as an 
enhancement).
3) Things like file URLs are different since the file:// scheme doesn't have an 
authority part at all, so how UrlValidator handles authorities would have to be 
dependent on the scheme. (Maybe we have a FileUrlValidator or something.) This 
should be opened as a separate issue (as an enhancement). 

Thoughts?



> Add an option to allow 'localhost' as a valid hostname part in the URL
> ----------------------------------------------------------------------
>
>                 Key: VALIDATOR-248
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-248
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Routines
>    Affects Versions: 1.3.1 Release
>            Reporter: Sergey Nebolsin
>            Assignee: Ben Speakmon
>             Fix For: 1.4
>
>         Attachments: commons-validator-allow-localhost-r592416.patch, 
> commons-validator-allow-non-iana-tlds-r592416.patch
>
>
> Working on Grails we've discovered 
> (http://jira.codehaus.org/browse/GRAILS-1692) that commons-validator's 
> UrlValidator rejects URLs like "http://localhost:8080/tau_gwi_00/clif/cb/19";. 
> I looked at commons-validator sources and found that any URL which contains 
> 'localhost' as it's hostname part will be rejected.
> RFC-2396 (http://www.ietf.org/rfc/rfc2396.txt) accepts 'localhost' as a valid 
> hostname (appendix G.3 paragraph 2 says that explicitly).
> So, it would be good to have additional option (UrlValidator.ALLOW_LOCALHOST) 
> which will control UrlValidator behavior on localhost URLs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to