Bug 334767

Summary: KIO::file_copy from http not working correctly
Product: [Frameworks and Libraries] frameworks-kio Reporter: Marco Martin <notmart>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: bhush94, hrvoje.senjan, kdelibs-bugs, sebas
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marco Martin 2014-05-14 15:14:02 UTC
a call like
KIO::file_copy(source, destination, -1, KIO::Overwrite | KIO::HideProgressInfo)
where source is a walis http url pointing to a file and destination a valid local file url
will not cirrectly: sometimes the job will transfer something then get stuck, sometimes it will immediately terminate leaving an empty local file.

to easily try it, 
kioclient5 copy http://opendesktop.org/CONTENT/content-files/165238-SwissGuard.jpg file:///tmp/foo.jpg

or happening also in plasmashell, when trying to get a wallpaper from gethotnewstuff, the install operation will always fail (see https://bugs.kde.org/show_bug.cgi?id=332499)
I tracked down that bug down to knewstuff/src/core/installation.cpp line 206
KIO::FileCopyJob *job = KIO::file_copy(source, destination, -1, KIO::Overwrite | KIO::HideProgressInfo);
does not correctly download the file.

if i put a debug statement in void FileCopyJobPrivate::slotData(KIO::Job *, const QByteArray &data)
I see that an arbitrary quantity of data chunks arrive, then the transfer gets stuck.


Reproducible: Always
Comment 1 Bhushan Shah 2014-05-25 07:04:07 UTC
And even if it manages to download file then it have wrong time stamp..
Comment 2 Bhushan Shah 2014-05-26 11:44:28 UTC
I can confirm that.. KDeclarative uses KIO NetworkAccessManager. So in plasma mediacenter shell package not all thumbnails are loaded. http://bhush9.github.io/images/mediabrowser-youtube.png

If I remove usage of KIO then it works fine.. looks like problem in kio http slave.
Comment 3 Marco Martin 2014-06-02 17:13:32 UTC
Git commit 0996008ed3d3c6ce00ca996f434316e36387803a by Marco Martin.
Committed on 02/06/2014 at 17:11.
Pushed by mart into branch 'master'.

Other time_t->QDateTime porting issues

This ports back the other two places the cache times were resetted in kde4, in cacheParseResponseHeader and resetSessionSettings

REVIEW:118479

M  +7    -0    src/ioslaves/http/http.cpp

http://commits.kde.org/kio/0996008ed3d3c6ce00ca996f434316e36387803a