[Qt-interest] QNetworkReply
Info
info at misafe.com
Wed Sep 2 18:22:43 CEST 2009
Hi,
Does anyone use QNetworkAccessManager and QNetworkReply? I've some odd
behaviour with them in that the uploadProgress() event is fired and
has no real baring on the actual progress of the upload. For example,
an upload to an HTTPS address will fire the uploadProgress event a
number of times to indicate 100% complete when it has barely begun and
will stay at 100% until it has actually finished. This is not as
obvious when uploading to an HTTP address but it still gets to 100%
quite a while before it's actually at 100%.
For example, the following:
request.setUrl("https://192.168.1.2/receiver.jsp");
request.setRawHeader("Host", "192.168.1.2");
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
QNetworkRequest::AlwaysNetwork);
request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
request.setRawHeader("Connection", "Keep-Alive");
request.setRawHeader("Content-type", "application/octet-stream");
QNetworkReply *reply = manager->post(request, block);
connect(reply, SIGNAL(uploadProgress(qint64, qint64)), uploader,
SLOT(dataSendProgress(qint64, qint64)));
This will almost immediately get to 100% and then upload the data,
changing the https to http makes it more accurate but still way out.
Does anyone know if there is a way to make this more accurate or is
QNetworkAccessManager not appropriate for file uploads?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090902/9264bb46/attachment.html
More information about the Qt-interest-old
mailing list