http: Adding http_fetch_file().
Sometimes, you want to fetch a file in memory so you can store it on multiple places on disk whitout having to download it again or copy files. while http_fetch_page works for fetching data in memory, the possible filename found in the 'Content-Disposition' header-feild is not accounted to. http_fetch_file() fetches the data and store it in memory while trying to get ahold of the filename.
This commit is contained in:
parent
ad4ac41b13
commit
eb0702cd93
2 changed files with 56 additions and 5 deletions
9
http.h
9
http.h
|
|
@ -27,10 +27,19 @@ struct http_data {
|
|||
size_t len;
|
||||
};
|
||||
|
||||
struct http_file {
|
||||
struct http_data data;
|
||||
char *filename;
|
||||
};
|
||||
|
||||
struct http_data* http_fetch_page(const char *url);
|
||||
|
||||
struct http_file* http_fetch_file(const char *url);
|
||||
|
||||
int http_download_file(const char *url, const char *dir);
|
||||
|
||||
void http_free(struct http_data *data);
|
||||
|
||||
void http_free_file(struct http_file *file);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Reference in a new issue