removed trailing spaces ([[:space:]]+$)
This commit is contained in:
@@ -33,12 +33,12 @@ struct private_curl_fetcher_t {
|
||||
* Public data
|
||||
*/
|
||||
curl_fetcher_t public;
|
||||
|
||||
|
||||
/**
|
||||
* CURL handle
|
||||
*/
|
||||
CURL* curl;
|
||||
|
||||
|
||||
/**
|
||||
* Optional HTTP headers
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ struct private_curl_fetcher_t {
|
||||
static size_t append(void *ptr, size_t size, size_t nmemb, chunk_t *data)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
|
||||
|
||||
data->ptr = (u_char*)realloc(data->ptr, data->len + realsize);
|
||||
if (data->ptr)
|
||||
{
|
||||
@@ -68,9 +68,9 @@ static status_t fetch(private_curl_fetcher_t *this, char *uri, chunk_t *result)
|
||||
{
|
||||
char error[CURL_ERROR_SIZE];
|
||||
status_t status;
|
||||
|
||||
|
||||
*result = chunk_empty;
|
||||
|
||||
|
||||
if (curl_easy_setopt(this->curl, CURLOPT_URL, uri) != CURLE_OK)
|
||||
{ /* URL type not supported by curl */
|
||||
return NOT_SUPPORTED;
|
||||
@@ -85,7 +85,7 @@ static status_t fetch(private_curl_fetcher_t *this, char *uri, chunk_t *result)
|
||||
{
|
||||
curl_easy_setopt(this->curl, CURLOPT_HTTPHEADER, this->headers);
|
||||
}
|
||||
|
||||
|
||||
DBG2(" sending http request to '%s'...", uri);
|
||||
switch (curl_easy_perform(this->curl))
|
||||
{
|
||||
@@ -109,7 +109,7 @@ static status_t fetch(private_curl_fetcher_t *this, char *uri, chunk_t *result)
|
||||
static bool set_option(private_curl_fetcher_t *this, fetcher_option_t option, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
||||
va_start(args, option);
|
||||
switch (option)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ static void destroy(private_curl_fetcher_t *this)
|
||||
curl_fetcher_t *curl_fetcher_create()
|
||||
{
|
||||
private_curl_fetcher_t *this = malloc_thing(private_curl_fetcher_t);
|
||||
|
||||
|
||||
this->curl = curl_easy_init();
|
||||
if (this->curl == NULL)
|
||||
{
|
||||
@@ -178,11 +178,11 @@ curl_fetcher_t *curl_fetcher_create()
|
||||
return NULL;
|
||||
}
|
||||
this->headers = NULL;
|
||||
|
||||
|
||||
this->public.interface.fetch = (status_t(*)(fetcher_t*,char*,chunk_t*))fetch;
|
||||
this->public.interface.set_option = (bool(*)(fetcher_t*, fetcher_option_t option, ...))set_option;
|
||||
this->public.interface.destroy = (void (*)(fetcher_t*))destroy;
|
||||
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ struct curl_fetcher_t {
|
||||
* Implements fetcher interface
|
||||
*/
|
||||
fetcher_t interface;
|
||||
|
||||
|
||||
/**
|
||||
* Destroy a curl_fetcher instance.
|
||||
*/
|
||||
|
||||
@@ -52,24 +52,24 @@ plugin_t *plugin_create()
|
||||
{
|
||||
CURLcode res;
|
||||
private_curl_plugin_t *this = malloc_thing(private_curl_plugin_t);
|
||||
|
||||
|
||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||
|
||||
|
||||
res = curl_global_init(CURL_GLOBAL_NOTHING);
|
||||
if (res == CURLE_OK)
|
||||
{
|
||||
lib->fetcher->add_fetcher(lib->fetcher,
|
||||
(fetcher_constructor_t)curl_fetcher_create, "file://");
|
||||
lib->fetcher->add_fetcher(lib->fetcher,
|
||||
lib->fetcher->add_fetcher(lib->fetcher,
|
||||
(fetcher_constructor_t)curl_fetcher_create, "http://");
|
||||
lib->fetcher->add_fetcher(lib->fetcher,
|
||||
(fetcher_constructor_t)curl_fetcher_create, "https://");
|
||||
lib->fetcher->add_fetcher(lib->fetcher,
|
||||
lib->fetcher->add_fetcher(lib->fetcher,
|
||||
(fetcher_constructor_t)curl_fetcher_create, "ftp://");
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG1("global libcurl initializing failed: %s, curl disabled",
|
||||
DBG1("global libcurl initializing failed: %s, curl disabled",
|
||||
curl_easy_strerror(res));
|
||||
}
|
||||
return &this->public.plugin;
|
||||
|
||||
Reference in New Issue
Block a user