[Qt-interest] Bug in QUrl?

Thiago Macieira thiago at kde.org
Thu Nov 26 17:42:51 CET 2009


Em Quinta-feira 26 Novembro 2009, às 10:01:00, Simarillion escreveu:
> Hi,
> if I create a QUrl to our xml-rpc Server like this:
> 
> QUrl ServerURL;
> ServerURL.setUrl("http://study.hiper-campus.com/?q=services/xmlrpc");
> 
> or
> 
> QUrl ServerURL("http://studien.hiper-campus.de/?q=services/xmlrpc");
> 
> ,afterwards the QUrl.path() variable is empty. Is this due to the question
> mark? Is it a bug?

Well, it's not a bug because it's not empty:

$ cat main.cpp
#include <QUrl>
#include <QDebug>

int main()
{
    QUrl ServerURL("http://studien.hiper-campus.de/?q=services/xmlrpc");
    qDebug() << ServerURL.path();
}
$ ./qurl
"/"

I've tested that same program with Qt 4.3, 4.4, 4.5 and 4.6. All of them have 
the exact same behaviour.

The decomposition of that URL is:
scheme = "http"
username = null
password = null
  -> userinfo = null
host = "studien.hiper-campus.de"
port = -1
  -> authority = "studien.hiper-campus.de"
path = "/"
fragment = null
query = "q=services/xmlrpc"

Note that QUrl makes a slight distinction between empty and null. For example, 
if the fragment were "" (empty but not null), the URL would be reconstructed 
as:
	http://studien.hiper-campus.de/#?q=services/xmlrpc

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091126/47ba8a4a/attachment.bin 


More information about the Qt-interest-old mailing list