summaryrefslogtreecommitdiffstats
path: root/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-04-24 15:57:24 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-05 03:50:41 +0200
commit32adb82741b0a4851624b2e6b441b8d83fe6daf0 (patch)
treef09976a30c716ed20ca9403567ea57a51d198ae0 /tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp
parent1aeaf0e7089c893a927a5ab311a6176aad5874a7 (diff)
Enable specifying raw headers for the request
Use "--headers=file" where the file contains the raw headers to send. This is useful for replaying requests from log files. Change-Id: I3bbe582d96fc9797f692a0d5772e8164f8265ce0 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Diffstat (limited to 'tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp')
-rw-r--r--tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp b/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp
index 5eab6d43bd..f581315c60 100644
--- a/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp
+++ b/tests/manual/qnetworkaccessmanager/qget/downloadmanager.cpp
@@ -61,23 +61,20 @@ DownloadManager::~DownloadManager()
}
-void DownloadManager::get(const QUrl &url, const QString &user, const QString &password)
+void DownloadManager::get(const QNetworkRequest &request, const QString &user, const QString &password)
{
- DownloadItem *dl = new DownloadItem(QNetworkRequest(url), user, password, nam);
+ DownloadItem *dl = new DownloadItem(request, user, password, nam);
transfers.append(dl);
connect(dl, SIGNAL(downloadFinished(TransferItem*)), SLOT(downloadFinished(TransferItem*)));
}
-void DownloadManager::upload(const QUrl &url, const QString &user, const QString &password, const QString &filename, const QString &contentType, TransferItem::Method method)
+void DownloadManager::upload(const QNetworkRequest &request, const QString &user, const QString &password, const QString &filename, TransferItem::Method method)
{
QScopedPointer<QFile> file(new QFile(filename));
if (!file->open(QFile::ReadOnly)) {
qDebug() << "Can't open input file" << file->fileName() << file->errorString();
return;
}
- QNetworkRequest request(url);
- if (!contentType.isEmpty())
- request.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
UploadItem *ul = new UploadItem(request, user, password, nam, file.take(), method);
transfers.append(ul);
connect(ul, SIGNAL(downloadFinished(TransferItem*)), SLOT(downloadFinished(TransferItem*)));