[swift-corelibs-dev] NSURLSession & libcurl

Daniel Eggert danieleggert at me.com
Mon Mar 14 12:22:48 CDT 2016

> On 14 Mar 2016, at 17:43, Philippe Hausler <phausler at apple.com> wrote:
> [...]
> Overall I think this might be a decent place to start; and it seems to be a sensible approach. Integrating it for linux builds might be held up a bit until we can get libdispatch fully integrated.

I have three questions:

(1) What would be a reasonable way to add tests? Should I add an in-process HTTP server. Something along the lines of


(2) How would I go about pulling in libcurl? I could add

#include <curl/curl.h>

to ForSwiftFoundationOnly.h -- but I'd also need to add helpers for variadic function like so:

static inline CURLcode curl_easy_setopt_ptr(CURL *_Nonnull curl, CURLoption option, void *_Nullable a) {
    return curl_easy_setopt(curl, option, a);
static inline CURLcode curl_easy_setopt_int(CURL *_Nonnull curl, CURLoption option, int a) {
    return curl_easy_setopt(curl, option, a);
static inline CURLcode curl_easy_setopt_wc(CURL *_Nonnull curl, CURLoption option, size_t(*_Nullable a)(char *_Nonnull, size_t, size_t, void *_Nullable)) {
    return curl_easy_setopt(curl, option, a);

where should these go?

(3) Is it ok for me to split the libcurl specific code into a separate file, or should I try to keep everything inside NSURLSession.swift?


More information about the swift-corelibs-dev mailing list