Re: NSURLProtocol and NSXPC
Re: NSURLProtocol and NSXPC
- Subject: Re: NSURLProtocol and NSXPC
- From: Jens Alfke <email@hidden>
- Date: Mon, 21 Dec 2015 11:12:10 -0800
On Dec 21, 2015, at 10:28 AM, Daryle Walker < email@hidden> wrote:
Can a new URL protocol class use an XPC to sandbox the Internet work?
It should be able to. I don’t know how XPC works, but ten years ago I implemented an NSURLProtocol that used Mach messages to call a background agent process that generated the HTTP responses. (This was the implementation of the ‘ feed:' protocol in Safari in 10.5-10.7; the RSS UI was actually a web app served by the PubSubAgent process.)
All you need to do is create some sort of session identifier for each instance of your protocol subclass (i.e. by incrementing a global counter) and send that ID along with messages to the XPC process. That process can then include the same identifiers in its replies, so you can route them to the appropriate protocol instance.
—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