[KIO] Regarding KIO based redirection handling and header responses

Dawit A adawit at kde.org
Sun Jun 3 03:31:53 BST 2012


Unless you explicitly disable internal redirection handling, you will never
be able to get the redirection HTTP header from kio_http if you are
attempting to read from a slot connected to KIO's "result" signal. Instead,
what you should try to do is connect to the "mimeType" signal and look for
the meta-data there.

On Sat, Jun 2, 2012 at 9:00 PM, Aish Raj Dahal <dahalaishraj at gmail.com>wrote:

> Respected members of the community,
>
> First of all let me introduce myself. I am a Google Summer of Code 2012
> student implementing Metalink/HTTP [RFC 6249] support in Kget. In most
> basic terms my implementation involves receiving of the custom HTTP
> response header fields sent by the server supporting Metalink/HTTP. I have
> been trying to use KIO and extract the information from the custom HTTP
> response headers sent back by the server, however it has been in vain.
>
> I am using
> http://download.services.openoffice.org/files/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gzto check the Metalink/HTTP. It works fine while running
>
> curl -sI
> http://download.services.openoffice.org/files/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz
>
> However, while doing so using KIO, I've encountered problems.
> It seems that the header replies that KIO gets are of the redirected
> download link, ( the same  as Konqueror gets it while typing the link in
> the address bar)
> However my objective is to prevent the redirection and directly obtain the
> HTTP header response sent by the server.
> I have tried with setRedirectionHandlingEnabled(false). But on doing this
> there is no response and the program gets stuck.
> On removing the redirection handling code and setting it to the defaults
> the redirection presisits.
>
>
> The output that(with the redirection left to defaults) I get is
>
> "HTTP/1.1 200
> OK
> server:
> nginx/0.8.54
> date: Fri, 25 May 2012 14:32:56
> GMT
> content-type:
> application/octet-stream
> content-length: 8957266
> last-modified: Mon, 17 Jan 2011 22:03:15 GMT
> connection: close
> accept-ranges: bytes"
>
> And the output that I should be actually getting is:
>
> HTTP/1.1 302 Found
> Date: Fri, 25 May 2012 13:13:14 GMT
> Server: Apache/2.2.22 (Linux/SUSE)
> X-Prefix: 49.244.64.0/21
> X-AS: 23752
> X-MirrorBrain-Mirror: mirror.averse.net
> X-MirrorBrain-Realm: region
> Link: <
> http://download.services.openoffice.org/files/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz.meta4>;
> rel=describedby; type="application/metalink4+xml"
> Link: <
> http://download.services.openoffice.org/files/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz.torrent>;
> rel=describedby; type="application/x-bittorrent"
> Link: <
> http://mirror.averse.net/openoffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz>;
> rel=duplicate; pri=1; geo=sg
> Link: <
> http://ftp.isu.edu.tw/pub/OpenOffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz>;
> rel=duplicate; pri=2; geo=tw
> Link: <
> http://ftp.twaren.net/OpenOffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz>;
> rel=duplicate; pri=3; geo=tw
> Link: <
> http://ftp.kaist.ac.kr/openoffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz>;
> rel=duplicate; pri=4; geo=kr
> Link: <
> http://mirror.yongbok.net/openoffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz>;
> rel=duplicate; pri=5; geo=kr
> Digest: MD5=chZROzRjy791zYb5mUhk3A==
> Digest: SHA=nRgEtguiGxDlu8PKSxyBSc7TlGw=
> Digest: SHA-256=VO2S9pgCq1lqgTFTKssVj6amn0npNdagtjI8ziDtiRQ=
> Location:
> http://mirror.averse.net/openoffice/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz
> Connection: close
> Content-Type: text/html; charset=iso-8859-1
>
> My "practice" repository is at
> https://github.com/ardahal/kio-learner/tree/master/showHttp
>
> I hope you'll go through the code and help me with figuring out how to get
> the desired result. :)
>
> Thanks a lot.
>
> Cheers
> Aish
> Google Summer of Code Student 2012
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20120602/d11028f4/attachment.htm>


More information about the kfm-devel mailing list