diff options
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 6 | ||||
-rw-r--r-- | src/network/access/qhttpthreaddelegate.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessbackend.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager_p.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 16 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qspdyprotocolhandler.cpp | 20 |
7 files changed, 20 insertions, 34 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 360f9722c7..7ff6bffed3 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -1203,7 +1203,7 @@ QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt, connectionType)), parent) { Q_D(QHttpNetworkConnection); - d->networkSession = networkSession; + d->networkSession = qMove(networkSession); d->init(); } @@ -1215,7 +1215,7 @@ QHttpNetworkConnection::QHttpNetworkConnection(quint16 connectionCount, const QS connectionType)), parent) { Q_D(QHttpNetworkConnection); - d->networkSession = networkSession; + d->networkSession = qMove(networkSession); d->init(); } #else @@ -1339,7 +1339,7 @@ QSharedPointer<QSslContext> QHttpNetworkConnection::sslContext() void QHttpNetworkConnection::setSslContext(QSharedPointer<QSslContext> context) { Q_D(QHttpNetworkConnection); - d->sslContext = context; + d->sslContext = qMove(context); } void QHttpNetworkConnection::ignoreSslErrors(int channel) diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index 76107d3110..8743989dec 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -188,7 +188,7 @@ public: QHttpNetworkConnection::ConnectionType connectionType, QSharedPointer<QNetworkSession> networkSession) : QHttpNetworkConnection(hostName, port, encrypt, connectionType, /*parent=*/0, - networkSession) + qMove(networkSession)) #endif { setExpires(true); diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index b4aaca0851..acaba33dee 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -130,9 +130,9 @@ QStringList QNetworkAccessManagerPrivate::backendSupportedSchemes() const QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() { if (reply->outgoingDataBuffer) - uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(reply->outgoingDataBuffer)); + uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(reply->outgoingDataBuffer); else if (reply->outgoingData) { - uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(reply->outgoingData)); + uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(reply->outgoingData); } else { return 0; } diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 9528330aae..bd5a6faeef 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -92,7 +92,7 @@ public: initializeSession(true), #endif cookieJarCreated(false), - authenticationManager(new QNetworkAccessAuthenticationManager) + authenticationManager(QSharedPointer<QNetworkAccessAuthenticationManager>::create()) { } ~QNetworkAccessManagerPrivate(); diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 56105a544b..3ac8b8f56f 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -194,7 +194,7 @@ QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manage if (d->synchronous && outgoingData) { // The synchronous HTTP is a corner case, we will put all upload data in one big QByteArray in the outgoingDataBuffer. // Yes, this is not the most efficient thing to do, but on the other hand synchronous XHR needs to die anyway. - d->outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); + d->outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); qint64 previousDataSize = 0; do { previousDataSize = d->outgoingDataBuffer->size(); @@ -277,6 +277,10 @@ void QNetworkReplyHttpImpl::abort() // call finished which will emit signals // FIXME shouldn't this be emitted Queued? d->error(OperationCanceledError, tr("Operation canceled")); + + // If state is WaitingForSession, calling finished has no effect + if (d->state == QNetworkReplyHttpImplPrivate::WaitingForSession) + d->state = QNetworkReplyHttpImplPrivate::Working; d->finished(); } @@ -440,8 +444,8 @@ QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate() , downloadBufferReadPosition(0) , downloadBufferCurrentSize(0) , downloadZerocopyBuffer(0) - , pendingDownloadDataEmissions(new QAtomicInt()) - , pendingDownloadProgressEmissions(new QAtomicInt()) + , pendingDownloadDataEmissions(QSharedPointer<QAtomicInt>::create()) + , pendingDownloadProgressEmissions(QSharedPointer<QAtomicInt>::create()) #ifndef QT_NO_SSL , pendingIgnoreAllSslErrors(false) #endif @@ -1724,7 +1728,7 @@ void QNetworkReplyHttpImplPrivate::_q_bufferOutgoingData() if (!outgoingDataBuffer) { // first call, create our buffer - outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); + outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); @@ -1853,9 +1857,9 @@ QNonContiguousByteDevice* QNetworkReplyHttpImplPrivate::createUploadByteDevice() Q_Q(QNetworkReplyHttpImpl); if (outgoingDataBuffer) - uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(outgoingDataBuffer)); + uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingDataBuffer); else if (outgoingData) { - uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(outgoingData)); + uploadByteDevice = QNonContiguousByteDeviceFactory::createShared(outgoingData); } else { return 0; } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index f51b85cba0..616019ea41 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -248,7 +248,7 @@ void QNetworkReplyImplPrivate::_q_bufferOutgoingData() if (!outgoingDataBuffer) { // first call, create our buffer - outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); + outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); @@ -367,7 +367,7 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const // The synchronous HTTP is a corner case, we will put all upload data in one big QByteArray in the outgoingDataBuffer. // Yes, this is not the most efficient thing to do, but on the other hand synchronous XHR needs to die anyway. if (synchronousHttpAttribute.toBool() && outgoingData) { - outgoingDataBuffer = QSharedPointer<QRingBuffer>(new QRingBuffer()); + outgoingDataBuffer = QSharedPointer<QRingBuffer>::create(); qint64 previousDataSize = 0; do { previousDataSize = outgoingDataBuffer->size(); diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 32a804e9f4..ab703981ee 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -506,25 +506,7 @@ QByteArray QSpdyProtocolHandler::composeHeader(const QHttpNetworkRequest &reques #endif uncompressedHeader.append(headerField(":version", "HTTP/1.1")); - QHostAddress add; // ### unify with the host parsing from QHttpNetworkConnection - QByteArray host; - QString hostName = m_connection->hostName(); - if (add.setAddress(hostName)) { - if (add.protocol() == QAbstractSocket::IPv6Protocol) - host = "[" + hostName.toLatin1() + "]"; //format the ipv6 in the standard way - else - host = hostName.toLatin1(); - - } else { - host = QUrl::toAce(hostName); - } - - int port = request.url().port(); - if (port != -1) { - host += ':'; - host += QByteArray::number(port); - } - uncompressedHeader.append(headerField(":host", host)); + uncompressedHeader.append(headerField(":host", request.url().authority(QUrl::FullyEncoded | QUrl::RemoveUserInfo).toLatin1())); uncompressedHeader.append(headerField(":scheme", request.url().scheme().toLatin1())); |