PDA

View Full Version : [Qt bug?] QNetworkReply::setReadBufferSize() and data loss



ultr
7th March 2011, 15:25
I'm having trouble using QNetworkReply::setReadBufferSize().

When I try to limit the buffer size to throttle down download speed, I get random data loss.
It always happens at the end of the transmitted content. The first big part of the content is always valid.


Is it safe to call QNetworkReply::setReadBufferSize() DURING the download?

I also use multiple QNetworkAccessManagers, but I guess this should not be the cause of the problem.


I checked the network traffic with Wireshark, and the missing part is there.

QNetworkReply::bytesAvailable() returns 0, so it looks like I'm reading all available data.


I don't exclude the possibility that it's just my mistake, but I cannot find it in my code.


Qt 4.6.3, Debian GNU/Linux 7.0 Wheezy


EDIT:
It seems to be a Qt bug.
The problem occurs when using QNetworkReply::setReadBufferSize() with downloads with unknown content length, i.e. no Content-Length header and downloadProgress()'s bytesTotal == 0.
On random occasions Qt does not provide the ending part in such cases.

ultr
8th March 2011, 06:27
http://bugreports.qt.nokia.com/browse/QTBUG-17991