summaryrefslogtreecommitdiff
path: root/src/network/access/qhttpnetworkrequest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qhttpnetworkrequest.cpp')
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index d5560b201d..566b611409 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qhttpnetworkrequest_p.h"
+#include "private/qnoncontiguousbytedevice_p.h"
#ifndef QT_NO_HTTP
@@ -47,8 +48,8 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
- : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), data(0),
- autoDecompress(false)
+ : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
+ autoDecompress(false), pipeliningAllowed(false)
{
}
@@ -57,8 +58,9 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
{
operation = other.operation;
priority = other.priority;
- data = other.data;
+ uploadByteDevice = other.uploadByteDevice;
autoDecompress = other.autoDecompress;
+ pipeliningAllowed = other.pipeliningAllowed;
}
QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate()
@@ -69,7 +71,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot
{
return QHttpNetworkHeaderPrivate::operator==(other)
&& (operation == other.operation)
- && (data == other.data);
+ && (uploadByteDevice == other.uploadByteDevice);
}
QByteArray QHttpNetworkRequestPrivate::methodName() const
@@ -111,7 +113,7 @@ QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const
QUrl::FormattingOptions format(QUrl::RemoveFragment);
// for POST, query data is send as content
- if (operation == QHttpNetworkRequest::Post && !data)
+ if (operation == QHttpNetworkRequest::Post && !uploadByteDevice)
format |= QUrl::RemoveQuery;
// for requests through proxy, the Request-URI contains full url
if (throughProxy)
@@ -128,11 +130,11 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request
{
QByteArray ba = request.d->methodName();
QByteArray uri = request.d->uri(throughProxy);
- ba += " " + uri;
+ ba += ' ' + uri;
QString majorVersion = QString::number(request.majorVersion());
QString minorVersion = QString::number(request.minorVersion());
- ba += " HTTP/" + majorVersion.toLatin1() + "." + minorVersion.toLatin1() + "\r\n";
+ ba += " HTTP/" + majorVersion.toLatin1() + '.' + minorVersion.toLatin1() + "\r\n";
QList<QPair<QByteArray, QByteArray> > fields = request.header();
QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin();
@@ -142,7 +144,7 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request
// add content type, if not set in the request
if (request.headerField("content-type").isEmpty())
ba += "Content-Type: application/x-www-form-urlencoded\r\n";
- if (!request.d->data && request.d->url.hasQuery()) {
+ if (!request.d->uploadByteDevice && request.d->url.hasQuery()) {
QByteArray query = request.d->url.encodedQuery();
ba += "Content-Length: "+ QByteArray::number(query.size()) + "\r\n";
ba += "\r\n";
@@ -238,14 +240,24 @@ void QHttpNetworkRequest::setPriority(Priority priority)
d->priority = priority;
}
-QIODevice *QHttpNetworkRequest::data() const
+bool QHttpNetworkRequest::isPipeliningAllowed() const
{
- return d->data;
+ return d->pipeliningAllowed;
}
-void QHttpNetworkRequest::setData(QIODevice *data)
+void QHttpNetworkRequest::setPipeliningAllowed(bool b)
{
- d->data = data;
+ d->pipeliningAllowed = b;
+}
+
+void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd)
+{
+ d->uploadByteDevice = bd;
+}
+
+QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const
+{
+ return d->uploadByteDevice;
}
int QHttpNetworkRequest::majorVersion() const