C Collections

chttpclient · Section 3

chttpcli_do_pooled

chttpcli_do_pooled - do an HTTP request on the shared Tier 2 engine, and block until it finishes

C Collections (libccollections, -lccollections)

#include <ccollections/chttpclient.h>
 
ccol_retval chttpcli_do_pooled(chttpcli cli,
                                 const chttp_request *req,
                                 chttpcli_response **resp_out);

This is a thin wrapper over chttpcli_do_async that submits the
request to the shared engine and blocks until it finishes. It returns
the same ccol_retval and takes resp_out the same way as
chttpcli_do, but the connect, the write and the read run on the
engine's reactor threads and not on the caller's thread. Any number of
callers on any number of chttpcli handles share one small, fixed-size
reactor thread pool, while with chttpcli_do every caller ties up its
own OS thread for the whole request.

cli      The client handle. It must not be CHTTPCLI_NULL.
req      The request to run. It must not be NULL.
resp_out It must not be NULL. The function sets it to NULL first and
         stores the response there if the call succeeds, with the
         same *resp_out contract as chttpcli_do.

The same result codes as chttpcli_do. A failed allocation, whether
before the request reaches the engine or while the engine runs it,
gives ccol_not_enough_memory. If the engine fails to start, you get the
code of that failure, ccol_not_enough_memory or
ccol_unexpected_failure. A bad URL, a TLS failure, a connection
failure, a transfer error, a timeout and too many redirects each return
the same specific code that chttpcli_do uses for them.

chttpcli_do(3), chttpcli_do_async(3), chttpcli_do_pooled_streaming(3), chttpcli_set_engine_logger(3), chttpcli_set_engine_mem_mgmt_procs(3)