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 23:04:51 GMT

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

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

>From RFC2396, section 3.2.2: "Hostnames take the form described in Section 3 of [RFC1034]
and  Section 2.1 of [RFC1123]: a sequence of domain labels separated by ".", each domain label
starting and ending with an alphanumeric character and possibly also containing "-" characters.
 The rightmost domain label of a fully qualified domain name will never start with a digit,
thus syntactically distinguishing domain names from IPv4 addresses, and may be followed by
a single "." if it is necessary to distinguish between the complete domain name and any local
domain. To actually be "Uniform" as a resource locator, a URL hostname should be a fully qualified
domain name.  In practice, however, the host component may be a local domain literal."

So, if I understand correctly, not supporting names like 'my-machine.my-local-domain', 'my-machine'
is againts RFC too, and I cannot see a difference between 'localhost' and 'my-computer' in
terms of RFC. However, I think that developer should have a choice. When we're developing
internet application, we don't want such local domains in most cases, since they make no sense
in internet. But if we're developing some intranet (or even local) application which leverages
the power of URLs, we want to allow local domains for sure. So this behavior should be configurable.

What about domain validation I can imagine two main modes: "strict" - hostname is checked
against IANA list, and "soft" which just checks hostname against general RFC rules.

I like configurable things, so it's great to have ALLOW_NON_IANA_TLDS (there might be a better
name) option as well as a possibility to provide a concrete list of "additional" allowed domain.
And at the very least I would like to have a possibility to substitute DomainValidator in
UrlValidator with my own implementation if I need some special behavior.

And I agree that we should open new issues for these enhancements when we'll decide about
the scope of these new issues.

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


Mime
View raw message