Vuo  1.2.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
VuoUrlFetch.c File Reference

Description

VuoUrlFetch implementation.

Classes

struct  VuoUrl_curlBuffer
 A memory buffer, filled by VuoUrl_curlCallback(). More...
 

Functions

 __attribute__ ((constructor))
 Initializes the cURL library.
 
static size_t VuoUrl_curlCallback (void *contents, size_t size, size_t nmemb, void *userp)
 Reads the contents of the URL into a memory buffer.
 
bool VuoUrl_fetch (const char *url, void **data, unsigned int *dataLength)
 Receives the data at the specified url.
 

Class Documentation

struct VuoUrl_curlBuffer
Class Members
char * memory
size_t size

Function Documentation

__attribute__ ( (constructor)  )

Initializes the cURL library.

static size_t VuoUrl_curlCallback ( void *  contents,
size_t  size,
size_t  nmemb,
void *  userp 
)
static

Reads the contents of the URL into a memory buffer.

A callback function for use by curl_easy_setopt().

bool VuoUrl_fetch ( const char *  url,
void **  data,
unsigned int *  dataLength 
)

Receives the data at the specified url.

The caller is responsible for free()ing the data.

data includes an extra trailing NULL terminator byte (not counted in dataLength), to make it easier to work with URLs containing plain text.

Returns
true upon success, false upon failure.
Todo:
Better error handling per https://b33p.net/kosada/node/4724