[Qt-interest] Access to HTTP Status Code with QNetworkReply

Geffrey Velasquez geffrix at hotmail.com
Thu Apr 22 09:53:33 CEST 2010




From: samuel.gaist at cinetis.ch
To: qt-interest at trolltech.com
Date: Thu, 22 Apr 2010 09:46:21 +0200
Subject: Re: [Qt-interest] Access to HTTP Status Code with QNetworkReply


On 22 avr. 10, at 09:20, Geffrey Velasquez wrote:Hi all,

I would like to know if its possible to access the HTTP Status code from a QNetworkReply object. I mean the codes defined by HTTP:

       Status-Code    = "200"   ; OK
                      | "201"   ; Created
                      | "202"   ; Accepted
                      | "204"   ; No Content
                      | "301"   ; Moved Permanently
                      | "302"   ; Moved Temporarily
                      | "304"   ; Not Modified
                      | "400"   ; Bad Request
                      | "401"   ; Unauthorized
                      | "403"   ; Forbidden
                      | "404"   ; Not Found
                      | "500"   ; Internal Server Error
                      | "501"   ; Not Implemented
                      | "502"   ; Bad Gateway
                      | "503"   ; Service Unavailable
                      | extension-code

       extension-code = 3DIGIT

I was trying with :

    QList<QByteArray> listHeaders;

    listHeaders = reply->rawHeaderList();

    QByteArray header;

    foreach(header, listHeaders) {
        printf("%s: %s\n", header.data(), reply->rawHeader(header).data());
    }


But the status code is not returned as Header. 


Regards,

Geffrey



Discover the new Windows Vista Learn more! _______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

Hi,Have a look at http://doc.trolltech.com/4.6/qnetworkreply.html#attribute
Hope it helpsSamuel



Thank you, 

The attribute is: QNetworkRequest::HttpStatusCodeAttribute


Regards,
Geffrey
 		 	   		  
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100422/fe6ccd09/attachment.html 


More information about the Qt-interest-old mailing list