summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-05-11 17:39:12 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-24 05:39:38 +0200
commit56cd31405241e81633ed6ae64b8f58c840b9a058 (patch)
tree03d4d3f4a24bcb32f4e59fc9a9c5b3d33f640757 /src/network
parent1573663182afd3d3371c131c564f4aeaf99d63d7 (diff)
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/network')
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index c105ca2d01..49bdf81a42 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;
}