Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-318

URLs with a hostname containing an underscore are not validated

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.3.1 Release, 1.4.0 Release
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      isValid returns false for following URL:

      http://www.nasza_sp77.republika.pl/

      which seems to be perfectly legal according to RFC:
      http://tools.ietf.org/html/rfc3986#section-2.3

      And a discussions here:
      http://stackoverflow.com/questions/2180465/can-someone-have-a-subdomain-with-an-underscore-in-it
      http://stackoverflow.com/questions/10959757/the-use-of-the-underscore-in-host-names

      Test code:

      String schemes[] = { "http", "https" };
      
      UrlValidator validator = new UrlValidator(schemes, UrlValidator.NO_FRAGMENTS);
      return validator.isValid("http://www.nasza_sp77.republika.pl/");
      

      This is somewhat similar to VALIDATOR-204, but that was for path part of URL and this one is for underscore in hostname.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                raffig RafaƂ Figas
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: