PDA

View Full Version : Progress jump using QNetworkReply and SSL



danc81
5th October 2009, 19:36
Hi,

Just joined the forums and have a quick question..

I'm using QNetworkAccessManager to send some large data to a server over SSL/HTTPS and the progress seems to jump forward by a large amount and then stop while the data is uploaded. This does not happen when using standard HTTP. I believe this was supposed to be fixed in 4.5.3 but it doesn't seem to be.

Does anyone have any ideas on how to get around it and display the progress correctly? Can anyone confirm they are seeing the same behaviour?

Thanks.

mgoetz
19th October 2009, 11:04
There is a patch for 4.5.x that should fix the issue. Would be nice if you try it and can confirm it works for you: http://pastebin.ca/1629178

Also try the 4.6 from git or the beta1. It should also work.

Good luck,
Markus

danc81
19th October 2009, 13:36
I can confirm that the patch for 4.5.x works perfectly! Thanks.

Now, what would be the best way to throttle an upload with QNetworkReply?

mgoetz
20th October 2009, 10:01
Hm. I could think of your upload QIODevice:

1. be non-sequential (e.g. random-access), else the HTTP upload code will buffer it all before uploading.
2. Have a timer that resets the upload "quota" and emits readyRead() of the QIODevice
3. Ever readData() call must only return up to "quota" bytes

Something like that.

danc81
5th November 2009, 20:20
After applying the patch to QNetworkAccessManager I'm seeing a crash when aborting the post request. Before the patch, I could abort the upload within the event loop and it would be find, after the patch, aborting causes a crash, details:



0xC0000005: Access violation reading location 0x00000004.

QtNetworkd4.dll!QHttpNetworkReply::d_func() Line 146 + 0xa bytes C++
QtNetworkd4.dll!QHttpNetworkConnectionPrivate::sen dRequest(QAbstractSocket * socket=0x01947210) Line 395 + 0x15 bytes C++
QtNetworkd4.dll!QHttpNetworkConnectionPrivate::_q_ encryptedBytesWritten(__int64 bytes=16421) Line 1374 C++
QtNetworkd4.dll!QHttpNetworkConnection::qt_metacal l(QMetaObject::Call _c=InvokeMetaMethod, int _id=19, void * * _a=0x0160d96c) Line 132 C++
QtCored4.dll!QMetaObject::activate(QObject * sender=0x01947210, int from_signal_index=27, int to_signal_index=27, void * * argv=0x0160d96c) Line 3104 + 0x2b bytes C++
QtCored4.dll!QMetaObject::activate(QObject * sender=0x01947210, const QMetaObject * m=0x640e5ba8, int local_signal_index=4, void * * argv=0x0160d96c) Line 3178 + 0x15 bytes C++
QtNetworkd4.dll!QSslSocket::encryptedBytesWritten( __int64 _t1=16421) Line 155 + 0x15 bytes C++
QtNetworkd4.dll!QSslSocketPrivate::_q_bytesWritten Slot(__int64 written=16421) Line 2034 C++
QtNetworkd4.dll!QSslSocket::qt_metacall(QMetaObjec t::Call _c=InvokeMetaMethod, int _id=16, void * * _a=0x0160da84) Line 115 + 0x1c bytes C++
QtCored4.dll!QMetaObject::activate(QObject * sender=0x019901b0, int from_signal_index=5, int to_signal_index=5, void * * argv=0x0160da84) Line 3104 + 0x2b bytes C++
QtCored4.dll!QMetaObject::activate(QObject * sender=0x019901b0, const QMetaObject * m=0x672b1d38, int local_signal_index=1, void * * argv=0x0160da84) Line 3178 + 0x15 bytes C++
QtCored4.dll!QIODevice::bytesWritten(__int64 _t1=16421) Line 92 + 0x14 bytes C++
QtNetworkd4.dll!QAbstractSocketPrivate::flush() Line 730 C++
QtNetworkd4.dll!QAbstractSocketPrivate::canWriteNo tification() Line 650 C++
QtNetworkd4.dll!QAbstractSocketPrivate::writeNotif ication() Line 78 + 0x15 bytes C++
QtNetworkd4.dll!QAbstractSocketEngine::writeNotifi cation() Line 161 C++
QtNetworkd4.dll!QWriteNotifier::event(QEvent * e=0x0160ded4) Line 1069 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QOb ject * receiver=0x01ae7460, QEvent * e=0x0160ded4) Line 4065 + 0x11 bytes C++
QtGuid4.dll!QApplication::notify(QObject * receiver=0x01ae7460, QEvent * e=0x0160ded4) Line 3605 + 0x10 bytes C++
QtCored4.dll!QCoreApplication::notifyInternal(QObj ect * receiver=0x01ae7460, QEvent * event=0x0160ded4) Line 610 + 0x15 bytes C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver=0x01ae7460, QEvent * event=0x0160ded4) Line 213 + 0x39 bytes C++
QtCored4.dll!qt_internal_proc(HWND__ * hwnd=0x005503ca, unsigned int message=1024, unsigned int wp=7220, long lp=2) Line 466 + 0xf bytes C++
user32.dll!_InternalCallWinProc@20() + 0x28 bytes
user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes
user32.dll!_DispatchMessageWorker@8() + 0xdc bytes
user32.dll!_DispatchMessageW@4() + 0xf bytes
QtCored4.dll!QEventDispatcherWin32::processEvents( QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 751 + 0x17 bytes C++
QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 150 C++
QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 201 + 0x2d bytes C++
QtCored4.dll!QThread::exec() Line 487 + 0x15 bytes C++
NetworkTest.exe!NetworkTest::run() Line 29 C++
QtCored4.dll!QThreadPrivate::start(void * arg=0x00c53520) Line 309 C++
msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C
msvcr80d.dll!_threadstartex(void * ptd=0x00cfcef8) Line 331 C
kernel32.dll!_BaseThreadStart@8() + 0x37 bytes


Can anyone confirm that this is caused by the patch?

Thanks