Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
4.6.2
-
None
-
Fedora 13 x86_64
Description
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" )