Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-10972

QUrl parses URLs containing absolute hostnames incorrectly


    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 4.6.2
    • Fix Version/s: None
    • Component/s: Network
    • Labels:
    • Environment:
      Fedora 13 x86_64


      QUrl parses URLs containing an absolute hostname (ending in a dot) incorrecly, for example QUrl("http://www.example.com./somefile")

      I believe that this is a bug as Section 3.2.2 of RFC 3986 explicitly permits such hostnames:

      A registered name intended for lookup in the DNS uses the syntax defined in Section 3.5 of [RFC1034] and Section 2.1 of [RFC1123]. Such a name consists of 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 in DNS may be followed by a single "." and should be if it is necessary to distinguish between the complete domain name and some local domain.

      The following code sample demonstrates the problem

      #include <QtCore/QCoreApplication>
      #include <QtCore/QUrl>
      #include <QtCore/QDebug>
      int main(int argc, char *argv[]) {
          QCoreApplication a(argc, argv);
          QUrl test("http://www.example.com./somefile");
          qDebug() << "Parsed = " << test;
          return 0;

      This gives

      [trav@stratus ~]$ ./qtbug-QUrl 
      Parsed =   QUrl( "http:/somefile" )  


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              tmacieir Thiago Macieira (closed Nokia identity) (Inactive)
              trav Travers Carter
            • Votes:
              0 Vote for this issue
              4 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes