views:

7

answers:

0

I have a problem similar to the one described in the link below.

http://stackoverflow.com/questions/2188099/nshttpurlresponse-statuscode-is-returning-zero-when-it-should-be-401

I use [NSURLConnection sendSynchronousRequest:returningResponse:error:] to get data from a server.

When NSURLConnection receives the HTTP Code 401, it does not return anything but an error object with code -1012 from the NSURLErrorDomain. -1012 corresponds to NSURLErrorUserCancelledAuthentication. Since i have to parse the HTTP Header i need to get the original error and not what NSURLConnection made out of it.

Is there a way to receive the original 401 http packet?