commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Burch (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (VALIDATOR-288) UrlValidator does not validate URL with simple domains (eg: http://hostname )
Date Fri, 27 May 2011 17:05:48 GMT

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

Nick Burch commented on VALIDATOR-288:
--------------------------------------

I've added a new option ALLOW_LOCAL_URLS in r1128396. With this set, http://localhost/ and
http://machinename/ are accepted (the previous behaviour of them not being accepted remains
if this isn't set)

I've also added your test, with a few tweaks to use the option, thanks for that

> UrlValidator does not validate URL with simple domains (eg: http://hostname )
> -----------------------------------------------------------------------------
>
>                 Key: VALIDATOR-288
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-288
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Routines
>    Affects Versions: 1.3.1 Release
>            Reporter: feroze daud
>             Fix For: 1.4
>
>         Attachments: VALIDATOR-288-testcase.patch
>
>
> A Url of the form "http://hostname" is not validated, when the hostname is simple, i.e
does not have any dots.
> I think this is a valid URL and it should pass validation.
> The bug is in UrlValidator::isValidAuthority(), line 382
>             String topLevel = domainSegment[segmentCount - 1];
>             if (topLevel.length() < 2 || topLevel.length() > 4) {
>                 return false;
>             }
> In this case, topLevel = "hostname"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message