diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-13 11:31:36 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-13 11:41:15 (GMT) |
commit | 1ed4c52dd7ad3cb6b0d846464b69489031ab68a5 (patch) | |
tree | d7abb0fbe0b28460572a2cdc60acf06d5e5504ae /src/network | |
parent | 9b6eacab99673d7d9848b341c4cf36a7c35f07c0 (diff) | |
download | Qt-1ed4c52dd7ad3cb6b0d846464b69489031ab68a5.zip Qt-1ed4c52dd7ad3cb6b0d846464b69489031ab68a5.tar.gz Qt-1ed4c52dd7ad3cb6b0d846464b69489031ab68a5.tar.bz2 |
QNAM: Fix double sending of a HTTP request
In some cases, weird timing issues could occur. In those cases, an EOF
was sent twice for the upload data, leading to the HTTP code being
confused and sending the request headers twice.
Task-number: 257662
Reviewed-by: Thiago Macieira
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index ce800c2..c57157e 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -628,6 +628,10 @@ void QNetworkAccessHttpBackend::closeUpstreamChannel() { // this indicates that the user finished uploading the data for POST Q_ASSERT(uploadDevice); + + if (uploadDevice->eof) + return; // received a 2nd time. should fix 257662 and 256369 + uploadDevice->eof = true; emit uploadDevice->readChannelFinished(); } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 63a9c2d..98944fd 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -92,6 +92,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() void QNetworkReplyImplPrivate::_q_sourceReadyRead() { + if (state != Working) + return; + // read data from the outgoingData QIODevice into our internal buffer enum { DesiredBufferSize = 32 * 1024 }; @@ -131,6 +134,8 @@ void QNetworkReplyImplPrivate::_q_sourceReadChannelFinished() void QNetworkReplyImplPrivate::_q_copyReadyRead() { Q_Q(QNetworkReplyImpl); + if (state != Working) + return; if (!copyDevice || !q->isOpen()) return; |