C Collections

chttpclient · Section 3

chttpcli_create_mp

chttpcli_create_mp - create an HTTP client with a custom allocator

C Collections (libccollections, -lccollections)

#include <ccollections/chttpclient.h>
 
chttpcli chttpcli_create_mp(ccol_memmgmt_procs *mprocs,
                            char **err_str);

This function allocates and initializes a new HTTP client. It does NOT
create the connection pool; that happens on the first request.
 
A new client starts with this configuration:
  pool size              = the CPU count (resolved on the first
                           request)
  connect timeout        = CHTTPCLI_DEFAULT_CONNECT_TIMEOUT_US (30 s)
  inactivity timeout     = CHTTPCLI_DEFAULT_INACTIVITY_TIMEOUT_US
                           (60 s)
  request timeout        = 0 (no timeout)
  max response body size = 0 (no limit)
  TLS                    = peer and host verification on,
                           system CA

mprocs    A custom allocator, or NULL for malloc/free.
err_str   Optional. It gets a static error string if the call fails.

A new client handle, or CHTTPCLI_NULL if the call fails.

chttpcli_create(3), chttpcli_destroy(3), chttpcli_set_pool_size(3)