I would expect NSURLProtocolClient to have a method that would allow passing the metrics to the client
Indeed.
however I wasn't able to find one.
That’s correct.
What would be the best approach to implement that kind of functionallity?
I don’t think you’ll be able to do this. CFNetwork’s support for custom protocols (that is, subclasses of
NSURLProtocol
) is rather lacking. It’s not
completely useless — there are scenarios where a custom protocol is the best way to get something done — but there’s no way that you can make a custom protocol that does all the stuff that the built-in HTTP[S] protocol does.
You should feel free to file an enhancement request for the features you need, making sure to describe your use case. However, I have to set expectations here.
NSURLProtocolClient
has not been updated to account for features that we added in Mac OS X 10.6 (!) [1], so it’s clearly not a high priority.
If you do file an ER, please post your bug number here, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
[1] Namely, an entry point that that’s equivalent to the
-connection:canAuthenticateAgainstProtectionSpace:
delegate callback.