From kde-devel Mon Jul 09 11:21:09 2012 From: Aish Raj Dahal Date: Mon, 09 Jul 2012 11:21:09 +0000 To: kde-devel Subject: Re: Using KIO to retrive HTTP Headers [GSoC student help] Message-Id: X-MARC-Message: https://marc.info/?l=kde-devel&m=134183210003167 > On Thursday 28 June 2012 06:13:15 Aish Raj Dahal wrote: >> The issue is that KIO attempts to download the entire file before >> being able to query for its HTTP header responses. This behavior may >> be taken lightly for smaller files, however for larger files >> downloading an entire file, just to get the HTTP header response >> associated with it seems to be impractical. > > As Albert said, the headers are sent as soon as they are received, and the > mimetype signal is emitted before the contents of the file, this is by contract > for KIO::get(). This is how we can put the job on hold while launching the > proper application for that url, and the app then resumes the download in > order to get the file contents. > > > Alternatively you could use KIO::mimetype which performs an HTTP HEAD request > on the given URL, but we had the experience (many years ago) that some > webservers didn't reply correctly to HEAD requests. > Hello, As you've suggested, I've made an attempt to get the headers using the mimetype signal as well as KIO::mimetype. Here( https://github.com/ardahal/kio-learner/ ) is a link to a git repository containing each type of implementation of getting headers on the branches "experimental" and "ard-dev" respectively. The branch experimental uses KIO::mimetype, while the branch "ard-dev" uses mimetype signal. Unfortunately both the implementations fail to get the headers. In case you'd like to have a more quick look to the files here are the links to their online versions 1) Using KIO::mimetype https://github.com/ardahal/kio-learner/blob/experimental/metalinkHttp/metalinkHttp.cpp 2) Using mimetype signal in KIO::TransferJob https://github.com/ardahal/kio-learner/blob/ard-dev/metalinkHttp/metalinkHttp.cpp I hope to have help from your side. Thanks a lot. Best Regards, AR Dahal >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<