diff options
author | Shane Kearns <ext-shane.2.kearns@nokia.com> | 2012-05-11 16:39:12 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-24 03:39:38 (GMT) |
commit | 56cd31405241e81633ed6ae64b8f58c840b9a058 (patch) | |
tree | 03d4d3f4a24bcb32f4e59fc9a9c5b3d33f640757 /src | |
parent | 1573663182afd3d3371c131c564f4aeaf99d63d7 (diff) | |
download | Qt-56cd31405241e81633ed6ae64b8f58c840b9a058.zip Qt-56cd31405241e81633ed6ae64b8f58c840b9a058.tar.gz Qt-56cd31405241e81633ed6ae64b8f58c840b9a058.tar.bz2 |
Properly handle unexpected EOF in QHttpThreadDelegate
This prevents http POST/PUT from hanging if the QIODevice being uploaded
returns -1 from read.
Task-number: QTBUG-24738
Change-Id: I76500cc4f0101cc8e5da5f1dc105508b3f519a3c
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
(cherry picked from commit 3976339ca9b12c7eddbc69ed3a31f85ce845ba63)
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qhttpthreaddelegate_p.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h index c105ca2..49bdf81 100644 --- a/src/network/access/qhttpthreaddelegate_p.h +++ b/src/network/access/qhttpthreaddelegate_p.h @@ -207,18 +207,21 @@ public: const char* readPointer(qint64 maximumLength, qint64 &len) { - if (m_amount == 0 && wantDataPending == false) { + if (m_amount > 0) { + len = m_amount; + return m_data; + } + + if (m_atEnd) { + len = -1; + } else if (!wantDataPending) { len = 0; wantDataPending = true; emit wantData(maximumLength); - } else if (m_amount == 0 && wantDataPending == true) { + } else { // Do nothing, we already sent a wantData signal and wait for results len = 0; - } else if (m_amount > 0) { - len = m_amount; - return m_data; } - // cannot happen return 0; } |