Skip to content

Draft: Create async HTTP client based on libcurl

Stefan Spettel requested to merge refactor_http_client_dns_lookup into develop


  • Let CURL handle DNS request (uses a DNS cache @arora)
  • (possible) made HTTP client library thread safe -> to be tested with unit tests and multiple concurrent threads
  • Remove curl_multi and use curl_simple as API
  • Create own asynchronous functions to call (synchronous) curl simple
  • 1 handler per remote host, thus all requests to one remote host are synchronous
    • To increase performance, we could create e.g. 10 (configurable) parallel TCP requests
    • We keep the connection so that CURL is able to reuse existing TCP connection
    • With HTTP/2 streams, we should not have this issue anymore


Manually tested scenarios on SMF, also tested what happens when existing connections are removed (e.g. NRF crash), also tested that timeout of 10 seconds works. No threads stayed hanging so far.

Merge request reports