KIO: how to get the header fields

Dawit A. adawit at kde.org
Fri May 2 15:19:31 BST 2003


On Friday 02 May 2003 08:29, Koos Vriezen wrote:

> What I would like is the responce code 404 and the header fields (I'am
> able to get both the mimetype and metadata field). How do I do that with
> kio?

Tell kio_http to send you the header information. It doesn't do that by 
default:

job->addMetaData("PropagateHttpHeader", "true");

To retrieve the returned header, simply query for "HTTP-Headers" meta-data in 
the slot that is connected to receive the incoming data:

QString headers = job->queryMetaData("HTTP-Headers");

Each header line is separated by "\n" so you can use QStringList::split to get 
the individual lines...

Regards,
Dawit A.




More information about the kfm-devel mailing list