lod_set_curl

Set a new cURL handle to be used by a context

Synopsis

#include <liblod.h>

int lod_set_model(LODCONTEXT *context, CURL *handle);

Description

lod_set_curl sets or resets the CURL handle associated with context.

Any existing CURL handle associated with the context will be discarded, freeing it (using curl_easy_cleanup) if it was automatically allocated by liblod, as is the case when a context is initially created.

If handle is NULL, a new CURL handle will be allocated and associated with context. This object will be automatically destroyed when it is no longer required.

If handle is not NULL, then the supplied CURL handle will be associated with context. liblod will not automatically destroy this CURL handle when it is is no longer required, and it is the calling application's responsibility to do so.

Caution

Do not destroy a CURL handle associated with a context until after it has either been replaced (via another call to lod_set_curl), or the context itself has been destroyed (by lod_destroy).

See also

liblod, lod_curl, lod_create, lod_destroy, lod_errmsg, curl_easy_init, curl_easy_cleanup.