[swift-corelibs-dev] NSURLSession & libcurl

Philippe Hausler phausler at apple.com
Mon Mar 14 09:36:41 CDT 2016

I dont think we had an intention set forth for how that was to be implemented; honestly it was a bit of a “we dont know how this should be done for linux yet” when the initial API drafts were posted. That being said NSURLSession and friends are definitely pretty important areas in Foundation (hence why the placeholder implementations are there).

libcurl is readily available for linux (but we would need to alter our dependencies list for apt-get) and also is shipped for Darwin targets as well. so in spirit it might be a decent place to start.

There are a few places that might need some research on how to approach an implementation:

1) Can curl’s APIs interface with run loops?

2) Can curl’s API provide a reasonable implementation to back other APIs? NSURLCache, NSURLRequest, NSURLResponse, even older APIs like NSURLConnection?

3) How would the background downloading part of NSURLSession be handled? Would it just elide that feature?

4) Can it handle the delegation protocols for all events? If not, can the events be synthesized?

> On Mar 14, 2016, at 2:05 AM, Daniel Eggert via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> Is the intention that NSURLSession should be implemented by wrapping libcurl?
> https://curl.haxx.se
> If so, I'm tempted to take a stab at this.
> /Daniel
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

More information about the swift-corelibs-dev mailing list