[Qt-interest] Request to URL including percent
KIMURA, Hidetaka
kimura at jig.jp
Wed Dec 17 03:36:12 CET 2008
Hello,
I am using the network component of Qt.
When I try to access a url that has a percent, it automatically encodes it
into %25 and sends it to the remote host.
Here is the sample code:
#include <QApplication>
#include <QDebug>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
QNetworkAccessManager manager;
QNetworkRequest req(QUrl("http://example.com/a%3Ab", QUrl::StrictMode));
QNetworkReply* rep = manager.get(req);
app.connect(rep, SIGNAL(finished()), SLOT(quit()));
int rv = app.exec();
qDebug() << "URL:" << rep->url();
return rv;
}
This program generates an HTTP request like this:
GET /a%253Ab HTTP1.1
Can I avoid this behavior and get correct request /a%3Ab ?
Thanks,
-------
KIMURA, Hide - kimura at jig.jp
More information about the Qt-interest-old
mailing list