summaryrefslogtreecommitdiffstats
path: root/src
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-15 04:57:02 +0200
commit3976339ca9b12c7eddbc69ed3a31f85ce845ba63 (patch)
treea65fbc5e307d5d4651655e8c57cc5f0c579385ac /src
parent1da0db344a6a0332c0284713d3ff645025c617f3 (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>
Diffstat (limited to 'src')
-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 7ac927ab1f..b2792c84a7 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -208,18 +208,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;
}