Returning custom NSURLResponse from NSURLProtocol
Returning custom NSURLResponse from NSURLProtocol
- Subject: Returning custom NSURLResponse from NSURLProtocol
- From: Jens Alfke <email@hidden>
- Date: Fri, 02 Dec 2011 10:04:28 -0800
I’ve got an NSURLProtocol implementation for an HTTP-like protocol. I want it to return a custom NSHTTPURLResponse instance to the client. However, the initializer method for NSHTTPURLResponse was only added in iOS 5 / OS X 10.7.2. I’d like to at least be able to support OS X 10.6. Is there any way around this?
— I can’t call the inherited init method because it doesn’t let me specify the status code and response headers.
— I tried subclassing NSHTTPURLResponse and overriding -statusCode and -allHeaderFields to return my own values. This has the weird effect that, back on the main thread, the NSURLConnection delegate gets a _different_ response object that’s a direct instance of NSURLResponse.
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden