The swift-corelibs-foundation's (scl-f)
URLSession implementation for protocols
http and ftp currently uses libcurl, provided by the host's package system or
built separately as part of the toolchain build (Windows). At the current time
these 2 protocols still have bugs and require more work to fix up authentication,
cookies, session metrics and some concurrency bugs in the general
codebase. It will take significant effort to fully implement everything that is
URLSession/http would become a thin wrapper around AHC, which already implements
most of the functionality required, although its delegate does need expanding to
allow mapping to all of the
URLSession delegate methods. This would allow using
the development effort of AHC/NIO and not splitting off resources to maintain
two full HTTP clients.
FTP support would be dropped unless an alternative FTP NIO client is developed.
AHC and NIO sources would be vended by scl-f meaning that a copy of the individual
packages would be copied into scl-f's source tree and then the NIO packages renamed
to avoid clashing with the normal NIO modules using a script. The modules would
then be imported
This would allow
FoundationNetworking to still be used by applications
using either NIO1 or NIO2 packages.
The source of the packages in the scl-f source tree would be manually updated as necessary.
Although a complete copy of the NIO sources would be built as part of scl-f, the
extra binary size of including NIO in
FoundationNetworking will still be smaller
than linking to libcurl, which on Ubunutu currently links to about 40 non-system
CMake would still be used to build scl-f so the NIO packages would require CMakefiles.
The following packages would be used:
This would mean that NIO support would need to be finished on Windows and would
be a future requirement for any platform that wanted to be supported by Swift.
This will not be a quick change to make as there are many parts that need to be implemented
URLSession code that remains will be ported to async/await if that is
found to be the best solution to fix concurrency issues. This will probably take at least a year.
Please note that even though
FoundationNetworking will use NIO code this does not
Foundation will become Swift packages.
It will still remain part of the toolchain and be built with CMake as part of the toolchain build.
Convert scl-f from an Xcode project to
Package.swiftto make it easier to
develop with packages. This DOES NOT mean scl-f itself will be a package, only
that it is easier for development and testing builds of scl-f itself on Linux
and macOS with packages.
Enhance AHC's client and delegate methods to provide all of the functionality
URLSession/http requires. This will also benefit clients of AHC.
_HTTPURLProtocolto use AHC.
Add CMakefiles for all of the NIO projects.