commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Nebolsin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (VALIDATOR-248) Add an option to allow 'localhost' as a valid hostname part in the URL
Date Tue, 06 Nov 2007 20:54:50 GMT

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

Sergey Nebolsin commented on VALIDATOR-248:
-------------------------------------------

Wow, guys, you're really responsive. Thinking further there might be not only 'localhost'
but any non-IANA TLD (I'd refer to appendix G.3 paragraph 2 of RFC-2396) again. For example,
I'm adding something into my local /etc/hosts. In this general case the option could be ALLOW_NON_IANA_TLDS
and it will cover 'localhost' case.

    public boolean isValid(String domain) {
        String[] groups = domainRegex.match(domain);
        if (groups != null && groups.length > 0) {
            return ALLOW_NON_IANA_TLDS || isValidTld(groups[0]);
        } else {
            return false;
        }
    }


> 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
>
>
> 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.


Mime
View raw message