02-26-2013 04:33 PM - edited 02-26-2013 04:35 PM
I would like to how to get the Response Header of a request made by using a tipical QNetworkAccessManager. What I really need is to get the server's date and I know the response header has it.
I saw you can access some header in the reply object of the requestFinished() function. But none of them is the Respone Header.
Does anyone have any idea about it?
Thanks in advance.
Solved! Go to Solution.
02-26-2013 04:45 PM - edited 02-26-2013 04:48 PM
If you're subscribing to QNetworkManager's void finished ( QNetworkReply * reply ) signal, use:
reply->rawHeaderList() to get a list of all available headers.
reply->header( param ) to get known headers, but they don't include Date.
reply->rawHeader("Date") to get the date or other custom headers.
Returns the raw contents of the header headerName as sent by the remote server. If there is no such header, returns an empty byte array, which may be indistinguishable from an empty header. Use hasRawHeader() to verify if the server sent such header field.