Get http statuscode from inputstream?

Hey all,

I created an inputstream like this :

	ScopedPointer<InputStream> inputstream ( url.createInputStream(
							false,				// usePostCommand
							nullptr,			// progressCallback :   &CDownloadThread::DownloadProgressCallback
							nullptr,			// progressCallbackContext 
							headers,			// extraHeaders 
							0,					// connectionTimeOutMs 
							responseHeaders));	// responseHeaders 

And now i would like to get the http response statuscode. On win32, this : “responseHeaders->getAllKeys()[0];” contains for example “HTTP/1.1 404 Not Found” , so i can extract the statuscode. However, on the mac: no such luck. Keys[0] does not contain this line.

How do i get the statuscode in a normal -working on win32 and mac- way ?


bump … Anyone ?

Sorry, I’ve never tried to get that info out of the headers - have you tried printing all the headers that get returned, and seeing what comes back on OSX?

Yes I have; no statuscode. I can’t imagine you not ever needing that :slight_smile: I mean, you have to know if u get a 404 or 200 or whatever right?

I’ve used the URL class a lot, but only for under-the-hood XML/JSON comms between an app and a server. And in that case, it doesn’t generally matter why the server failed to respond correctly.

But, yes, it’s something I should probably sort out. Haven’t time to task-switch to look at it at the moment though.

Just wanting to bump this issue a little.

To remind you, there doesn’t seem to be any other way to get it - it doesn’t appear in the headers (I just checked it myself, too).

I’m personally only only interested in the first digit of the code - whether it’s 2xx or not… :smiley: