Review Request: New KIO::http_post and KIO::StoredHttpPost APIs that accept a QIODevice as input...

Dawit A adawit at kde.org
Fri Feb 4 15:33:23 GMT 2011


Ahh... I think you misunderstood the purpose of the patch or rather
the title of this review. The new APIs simply overload the existing
http post APIs such that the data you are going to post is sent
through a QIODevice (QFile or QBuffer) rather than a QByteArray. To be
clear here is the new overloaded API:

KIO_EXPORT TransferJob *http_post( const KUrl& url, QIODevice* device,
JobFlags flags = DefaultFlags );

compared to the existing one

KIO_EXPORT TransferJob *http_post( const KUrl& url, const QByteArray&
_staticData, JobFlags flags = DefaultFlags );

The flaws of the old API are very obvious and have been an issue since
ages. We got a 9 year old bug report about it. :( Passing the data to
be uploaded as a QByteArray is fine for small post data like this
repose I am writing in a web mail client. However, the memory usage it
will incur when normal users attempt to upload today's multimedia
objects (music, videos, and even some image files) is really not
acceptable. That is what the new API is trying to address. Hope that
clarifies it...


On Fri, Feb 4, 2011 at 7:12 AM, Allan Sandfeld Jensen <kde at carewolf.com> wrote:
> Is QIODevice the best idea to use as source?
>
> Since we are talking KIO, I believe we can espect the user of KIO::http_post
> to be using KIO and not Qt IO. So would it instead be possible to make the
> source a KIO job or KUrl?
>
> Regards
>
> `Allan
>
> On Wednesday 02 February 2011, Dawit Alemayehu wrote:
>
>> -----------------------------------------------------------
>
>> This is an automatically generated e-mail. To reply, visit:
>
>> http://git.reviewboard.kde.org/r/100516/
>
>> -----------------------------------------------------------
>
>>
>
>> Review request for kdelibs.
>
>>
>
>>
>
>> Summary
>
>> -------
>
>>
>
>> The attached patch is the first portion a set of patches to make uploading
>
>> data through HTTP more efficient without affecting the existing
>
>> implementation. Right now the amount of memory consumed when uploading
>
>> large files through http or webdav is really not acceptable because only a
>
>> QByteArray based API is available. That means if you want to upload a file
>
>> of say 50 or 100 MB to a server, then you have to read the entire thing
>
>> first before you can call KIO::http_post!
>
>>
>
>>
>
>> This addresses bug 34578.
>
>> http://bugs.kde.org/show_bug.cgi?id=34578
>
>>
>
>>
>
>> Diffs
>
>> -----
>
>>
>
>> kio/kio/jobclasses.h e9bd191
>
>> kio/kio/job_p.h daac895
>
>> kio/kio/job.cpp 7d4a849
>
>> kio/kio/job.h 632dfc8
>
>>
>
>> Diff: http://git.reviewboard.kde.org/r/100516/diff
>
>>
>
>>
>
>> Testing
>
>> -------
>
>>
>
>> Used by changing kdewebkit to use the new API.
>
>>
>
>>
>
>> Thanks,
>
>>
>
>> Dawit
>
>




More information about the kde-core-devel mailing list