/* NOT THREAD SAFE */ #ifndef _FETCH_H #define _FETCH_H #include #include struct fetch { CURL *handle; }; struct response { char *data; size_t size; char *content_type; /* Don't free. Managed by libcurl. */ }; typedef size_t (*CurlWriteCallback)(void *ptr, size_t size, size_t nmemb, void *userdata); struct fetch *fetch_init(void); struct response *fetch(struct fetch *restrict f, CURLU *restrict url); void fetch_cleanup(struct fetch *f); void response_cleanup(struct response *resp); #endif