removed trailing spaces ([[:space:]]+$)
This commit is contained in:
@@ -33,36 +33,36 @@ typedef enum fetcher_option_t fetcher_option_t;
|
||||
*/
|
||||
enum fetcher_option_t {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Data to include in fetch request, e.g. on a HTTP post.
|
||||
* Additional argument is a chunk_t
|
||||
*/
|
||||
FETCH_REQUEST_DATA,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Mime-Type of data included in FETCH_REQUEST_DATA.
|
||||
* Additional argument is a char*.
|
||||
*/
|
||||
FETCH_REQUEST_TYPE,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* HTTP header to be sent with with the fetch request.
|
||||
* Additional argument is a char*.
|
||||
*/
|
||||
FETCH_REQUEST_HEADER,
|
||||
|
||||
/**
|
||||
/**
|
||||
* Use HTTP Version 1.0 instead of 1.1.
|
||||
* No additional argument is needed.
|
||||
*/
|
||||
FETCH_HTTP_VERSION_1_0,
|
||||
|
||||
/**
|
||||
/**
|
||||
* Timeout to use for fetch, in seconds.
|
||||
* Additional argument is u_int
|
||||
*/
|
||||
FETCH_TIMEOUT,
|
||||
|
||||
|
||||
/**
|
||||
* end of fetching options
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ struct fetcher_t {
|
||||
* - FAILED, NOT_FOUND, PARSE_ERROR on failure
|
||||
*/
|
||||
status_t (*fetch)(fetcher_t *this, char *uri, chunk_t *result);
|
||||
|
||||
|
||||
/**
|
||||
* Set a fetcher option, as defined in fetcher_option_t.
|
||||
*
|
||||
@@ -107,11 +107,11 @@ struct fetcher_t {
|
||||
* @return TRUE if option supported, FALSE otherwise
|
||||
*/
|
||||
bool (*set_option)(fetcher_t *this, fetcher_option_t option, ...);
|
||||
|
||||
|
||||
/**
|
||||
* Destroy the fetcher instance.
|
||||
*/
|
||||
void (*destroy)(fetcher_t *this);
|
||||
void (*destroy)(fetcher_t *this);
|
||||
};
|
||||
|
||||
#endif /** FETCHER_H_ @}*/
|
||||
|
||||
@@ -30,12 +30,12 @@ struct private_fetcher_manager_t {
|
||||
* public functions
|
||||
*/
|
||||
fetcher_manager_t public;
|
||||
|
||||
|
||||
/**
|
||||
* list of registered fetchers, as entry_t
|
||||
*/
|
||||
linked_list_t *fetchers;
|
||||
|
||||
|
||||
/**
|
||||
* read write lock to list
|
||||
*/
|
||||
@@ -68,7 +68,7 @@ static status_t fetch(private_fetcher_manager_t *this,
|
||||
status_t status = NOT_SUPPORTED;
|
||||
entry_t *entry;
|
||||
bool capable = FALSE;
|
||||
|
||||
|
||||
this->lock->read_lock(this->lock);
|
||||
enumerator = this->fetchers->create_enumerator(this->fetchers);
|
||||
while (enumerator->enumerate(enumerator, &entry))
|
||||
@@ -119,7 +119,7 @@ static status_t fetch(private_fetcher_manager_t *this,
|
||||
fetcher->destroy(fetcher);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
status = fetcher->fetch(fetcher, url, response);
|
||||
fetcher->destroy(fetcher);
|
||||
/* try another fetcher only if this one does not support that URL */
|
||||
@@ -142,11 +142,11 @@ static status_t fetch(private_fetcher_manager_t *this,
|
||||
/**
|
||||
* Implementation of fetcher_manager_t.add_fetcher.
|
||||
*/
|
||||
static void add_fetcher(private_fetcher_manager_t *this,
|
||||
static void add_fetcher(private_fetcher_manager_t *this,
|
||||
fetcher_constructor_t create, char *url)
|
||||
{
|
||||
entry_t *entry = malloc_thing(entry_t);
|
||||
|
||||
|
||||
entry->url = strdup(url);
|
||||
entry->create = create;
|
||||
|
||||
@@ -163,7 +163,7 @@ static void remove_fetcher(private_fetcher_manager_t *this,
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
entry_t *entry;
|
||||
|
||||
|
||||
this->lock->write_lock(this->lock);
|
||||
enumerator = this->fetchers->create_enumerator(this->fetchers);
|
||||
while (enumerator->enumerate(enumerator, &entry))
|
||||
@@ -194,15 +194,15 @@ static void destroy(private_fetcher_manager_t *this)
|
||||
fetcher_manager_t *fetcher_manager_create()
|
||||
{
|
||||
private_fetcher_manager_t *this = malloc_thing(private_fetcher_manager_t);
|
||||
|
||||
|
||||
this->public.fetch = (status_t(*)(fetcher_manager_t*, char *url, chunk_t *response, ...))fetch;
|
||||
this->public.add_fetcher = (void(*)(fetcher_manager_t*, fetcher_constructor_t,char*))add_fetcher;
|
||||
this->public.remove_fetcher = (void(*)(fetcher_manager_t*, fetcher_constructor_t))remove_fetcher;
|
||||
this->public.destroy = (void(*)(fetcher_manager_t*))destroy;
|
||||
|
||||
|
||||
this->fetchers = linked_list_create();
|
||||
this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
|
||||
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,15 +51,15 @@ struct fetcher_manager_t {
|
||||
*/
|
||||
void (*add_fetcher)(fetcher_manager_t *this,
|
||||
fetcher_constructor_t constructor, char *url);
|
||||
|
||||
|
||||
/**
|
||||
* Unregister a previously registered fetcher implementation.
|
||||
*
|
||||
* @param constructor fetcher constructor function to unregister
|
||||
*/
|
||||
void (*remove_fetcher)(fetcher_manager_t *this,
|
||||
void (*remove_fetcher)(fetcher_manager_t *this,
|
||||
fetcher_constructor_t constructor);
|
||||
|
||||
|
||||
/**
|
||||
* Destroy a fetcher_manager instance.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user