![]() |
![]() |
![]() |
Grits Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
GritsHttp; GritsHttp * grits_http_new (const gchar *prefix
); void grits_http_free (GritsHttp *http
); gchar * grits_http_fetch (GritsHttp *http
,const gchar *uri
,const gchar *local
,GritsCacheType mode
,GritsChunkCallback callback
,gpointer user_data
); GList * grits_http_available (GritsHttp *http
,gchar *filter
,gchar *cache
,gchar *extract
,gchar *index
);
GritsHttp is a small wrapper around libsoup to provide data access using the Hyper Text Transfer Protocol. Each GritsHttp should be associated with a particular server or dataset, all the files downloaded for this dataset will be cached together in $HOME/.cache/grits/
GritsHttp * grits_http_new (const gchar *prefix
);
Create a new GritsHttp for the given prefix
|
The prefix in the cache to store the downloaded files. For example: * "/nexrad/level2/". |
Returns : |
the new GritsHttp |
void grits_http_free (GritsHttp *http
);
Frees resources used by http
and cancels any pending requests.
|
the GritsHttp to free |
gchar * grits_http_fetch (GritsHttp *http
,const gchar *uri
,const gchar *local
,GritsCacheType mode
,GritsChunkCallback callback
,gpointer user_data
);
Fetch a file from the cache. Whether the file is actually loaded from the
remote server depends on the value of mode
.
|
the GritsHttp connection to use |
|
the URI to fetch |
|
the local name to give to the file |
|
the update type to use when fetching data |
|
callback to call when a chunk of data is received |
|
user data to pass to the callback |
Returns : |
The local path to the complete file |
GList * grits_http_available (GritsHttp *http
,gchar *filter
,gchar *cache
,gchar *extract
,gchar *index
);
Look through the cache and an HTTP index page for a list of available files. The name of each file that matches the filter is added to the returned list.
The list as well as the strings contained in it should be freed afterwards.
|
the GritsHttp connection to use |
|
filter used to extract files from the index, or NULL For example: "href=\"([^"]*)\"" |
|
path to the local cache, or NULL to not search the cache |
|
regex used to extract filenames from the page, should match the filename as $1, or NULL to use /http="([^"])"/ |
|
path to the index page, or NULL to not search online |
Returns : |
the list of matching filenames |