diff options
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 4ce7303dbb..c92c360420 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -754,6 +754,9 @@ void QNetworkReplyHttpImplPrivate::postRequest() QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual) httpRequest.setWithCredentials(false); + if (request.attribute(QNetworkRequest::EmitAllUploadProgressSignalsAttribute).toBool() == true) + emitAllUploadProgressSignals = true; + // Create the HTTP thread delegate QHttpThreadDelegate *delegate = new QHttpThreadDelegate; @@ -841,6 +844,9 @@ void QNetworkReplyHttpImplPrivate::postRequest() QObject::connect(delegate, SIGNAL(sslErrors(QList<QSslError>,bool*,QList<QSslError>*)), q, SLOT(replySslErrors(QList<QSslError>,bool*,QList<QSslError>*)), Qt::BlockingQueuedConnection); + QObject::connect(delegate, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), + q, SLOT(replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator*)), + Qt::BlockingQueuedConnection); #endif // This signal we will use to start the request. QObject::connect(q, SIGNAL(startHttpRequest()), delegate, SLOT(startRequest())); @@ -853,8 +859,6 @@ void QNetworkReplyHttpImplPrivate::postRequest() if (uploadByteDevice) { QNonContiguousByteDeviceThreadForwardImpl *forwardUploadDevice = new QNonContiguousByteDeviceThreadForwardImpl(uploadByteDevice->atEnd(), uploadByteDevice->size()); - if (uploadByteDevice->isResetDisabled()) - forwardUploadDevice->disableReset(); forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread() delegate->httpRequest.setUploadByteDevice(forwardUploadDevice); @@ -1262,6 +1266,12 @@ void QNetworkReplyHttpImplPrivate::replySslConfigurationChanged(const QSslConfig // Receiving the used SSL configuration from the HTTP thread this->sslConfiguration = sslConfiguration; } + +void QNetworkReplyHttpImplPrivate::replyPreSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator *authenticator) +{ + Q_Q(QNetworkReplyHttpImpl); + emit q->preSharedKeyAuthenticationRequired(authenticator); +} #endif // Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread @@ -1866,14 +1876,16 @@ void QNetworkReplyHttpImplPrivate::emitReplyUploadProgress(qint64 bytesSent, qin if (isFinished) return; - //choke signal emissions, except the first and last signals which are unconditional - if (uploadProgressSignalChoke.isValid()) { - if (bytesSent != bytesTotal && uploadProgressSignalChoke.elapsed() < progressSignalInterval) { - return; + if (!emitAllUploadProgressSignals) { + //choke signal emissions, except the first and last signals which are unconditional + if (uploadProgressSignalChoke.isValid()) { + if (bytesSent != bytesTotal && uploadProgressSignalChoke.elapsed() < progressSignalInterval) { + return; + } + uploadProgressSignalChoke.restart(); + } else { + uploadProgressSignalChoke.start(); } - uploadProgressSignalChoke.restart(); - } else { - uploadProgressSignalChoke.start(); } emit q->uploadProgress(bytesSent, bytesTotal); @@ -1891,12 +1903,6 @@ QNonContiguousByteDevice* QNetworkReplyHttpImplPrivate::createUploadByteDevice() return 0; } - bool bufferDisallowed = - request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, - QVariant(false)) == QVariant(true); - if (bufferDisallowed) - uploadByteDevice->disableReset(); - // We want signal emissions only for normal asynchronous uploads if (!synchronous) QObject::connect(uploadByteDevice.data(), SIGNAL(readProgress(qint64,qint64)), |