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>
This commit is contained in:
parent
1da0db344a
commit
3976339ca9
@ -208,18 +208,21 @@ public:
|
||||
|
||||
const char* readPointer(qint64 maximumLength, qint64 &len)
|
||||
{
|
||||
if (m_amount == 0 && wantDataPending == false) {
|
||||
len = 0;
|
||||
wantDataPending = true;
|
||||
emit wantData(maximumLength);
|
||||
} else if (m_amount == 0 && wantDataPending == true) {
|
||||
// Do nothing, we already sent a wantData signal and wait for results
|
||||
len = 0;
|
||||
} else if (m_amount > 0) {
|
||||
if (m_amount > 0) {
|
||||
len = m_amount;
|
||||
return m_data;
|
||||
}
|
||||
// cannot happen
|
||||
|
||||
if (m_atEnd) {
|
||||
len = -1;
|
||||
} else if (!wantDataPending) {
|
||||
len = 0;
|
||||
wantDataPending = true;
|
||||
emit wantData(maximumLength);
|
||||
} else {
|
||||
// Do nothing, we already sent a wantData signal and wait for results
|
||||
len = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user