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

Samuel Gaist samuel.gaist at cinetis.ch
Thu Apr 22 09:46:21 CEST 2010


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 helps
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100422/90e1803a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1587 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100422/90e1803a/attachment.bin 


More information about the Qt-interest-old mailing list