Multiple calls to connection:didReceiveResponse: ?
Multiple calls to connection:didReceiveResponse: ?
- Subject: Multiple calls to connection:didReceiveResponse: ?
- From: Jens Alfke <email@hidden>
- Date: Mon, 25 Feb 2013 21:22:30 -0800
I’ve been using NSURLConnection since 2003, but I didn’t know it was possible for the delegate’s connection:didReceiveResponse: method to be called more than once. But sure enough, the API docs say it is:
> In rare cases, for example in the case of an HTTP load where the content type of the load data is multipart/x-mixed-replace, the delegate will receive more than one connection:didReceiveResponse: message. In the event this occurs, delegates should discard all data previously delivered by connection:didReceiveData:, and should be prepared to handle the, potentially different, MIME type reported by the newly reported URL response.
This turned out to be the cause of a weird intermittent bug* in some of my code; since I didn’t know about this situation, I wasn’t handling it correctly when it did occur. :(
I’d like to know exactly what the “rare cases” consist of. I know that there was no x-mixed-replace action going on in this case. But the developer who found the bug has some proxying and load-balancing going on in their network between the client and server. Could this double-call be a side effect of proxy logins or similar HTTP esoterica?
—Jens
* https://github.com/couchbaselabs/TouchDB-iOS/issues/236
_______________________________________________
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