#include "ulinet.h"
#include "service.h"
Go to the source code of this file.
|
void | addToCache (maps *, char *, char *, char *, int, char *, size_t) |
| Cache a file for a given request. More...
|
|
char * | isInCache (maps *, char *) |
| Verify if a url is available in the cache. More...
|
|
int | runHttpRequests (maps **, maps **, HINTERNET *, map **) |
| Effectively run all the HTTP requests in the queue. More...
|
|
void | addRequestToQueue (maps **, HINTERNET *, const char *, bool) |
| Add a request in the download queue. More...
|
|
int | loadRemoteFile (maps **, map **, HINTERNET *, char *) |
| Try to load file from cache or download a remote file if not in cache. More...
|
|
char * | getMd5f (char *) |
| Compute md5 of a file. More...
|
|
int | storeMd5 (char *) |
|
void addRequestToQueue |
( |
maps ** |
m, |
|
|
HINTERNET * |
hInternet, |
|
|
const char * |
url, |
|
|
bool |
req |
|
) |
| |
Add a request in the download queue.
- Parameters
-
m | the maps containing the settings of the main.cfg file |
url | the url to add to the queue |
void addToCache |
( |
maps * |
conf, |
|
|
char * |
request, |
|
|
char * |
content, |
|
|
char * |
mimeType, |
|
|
int |
length, |
|
|
char * |
filepath, |
|
|
size_t |
max_path |
|
) |
| |
Cache a file for a given request.
For each cached file, the are two files stored, a .zca and a .zcm containing the downloaded content and the mimeType respectively.
- Parameters
-
conf | the maps containing the settings of the main.cfg file |
request | the url used too fetch the content |
content | the downloaded content |
mimeType | the content mimeType |
length | the content size |
filepath | a buffer for storing the path of the cached file; may be NULL |
max_path | the size of the allocated filepath buffer |
char* getMd5f |
( |
char * |
file | ) |
|
Compute md5 of a file.
- Parameters
-
- Returns
- a char* representing the md5 of the url
- Warning
- make sure to free resources returned by this function
char* isInCache |
( |
maps * |
conf, |
|
|
char * |
request |
|
) |
| |
Verify if a url is available in the cache.
- Parameters
-
conf | the maps containing the settings of the main.cfg file |
request | the url |
- Returns
- the full name of the cached file if any, NULL in other case
- Warning
- make sure to free resources returned by this function (if not NULL)
int loadRemoteFile |
( |
maps ** |
m, |
|
|
map ** |
content, |
|
|
HINTERNET * |
hInternet, |
|
|
char * |
url |
|
) |
| |
Try to load file from cache or download a remote file if not in cache.
- Parameters
-
m | the maps containing the settings of the main.cfg file |
content | the map to update |
hInternet | the HINTERNET pointer |
url | the url to fetch |
- Returns
- 0
Effectively run all the HTTP requests in the queue.
- Parameters
-
m | the maps containing the settings of the main.cfg file |
inputs | the maps containing the inputs (defined in the requests+added per default based on the zcfg file) |
hInternet | the HINTERNET pointer |
error | the error map pointer |
- Returns
- 0 on success, -1 on failure