This commit is contained in:
Fufu Fang 2018-07-26 10:58:51 +01:00
parent ea14adca98
commit 7383308e0f
5 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
{ {
"name": "mount-http-dir", "name": "HTTPDirFs",
"files": [ { "git": 1 } ] "files": [ { "git": 1 } ]
} }

View File

@ -5,6 +5,7 @@
#define FUSE_USE_VERSION 26 #define FUSE_USE_VERSION 26
#include <fuse.h> #include <fuse.h>
/* Initialise fuse */
int fuse_local_init(int argc, char **argv); int fuse_local_init(int argc, char **argv);
#endif #endif

4
link.c
View File

@ -9,7 +9,6 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#define HTTP_OK 200 #define HTTP_OK 200
#define HTTP_PARTIAL_CONTENT 206 #define HTTP_PARTIAL_CONTENT 206
#define HTTP_RANGE_NOT_SATISFIABLE 416 #define HTTP_RANGE_NOT_SATISFIABLE 416
@ -83,8 +82,7 @@ static CURL *Link_to_curl(Link *link)
} }
/* set up some basic curl stuff */ /* set up some basic curl stuff */
curl_easy_setopt(curl, CURLOPT_USERAGENT, "httpdirfs - \ curl_easy_setopt(curl, CURLOPT_USERAGENT, "HTTPDirFS");
https://github.com/fangfufu/httpdirfs");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0); curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
/* for following directories without the '/' */ /* for following directories without the '/' */

1
link.h
View File

@ -43,6 +43,7 @@ struct LinkTable {
/** \brief root link table */ /** \brief root link table */
extern LinkTable *ROOT_LINK_TBL; extern LinkTable *ROOT_LINK_TBL;
/** \brief set the stats for a file */
void Link_set_stat(Link* this_link, CURL *curl); void Link_set_stat(Link* this_link, CURL *curl);
/** \brief create a new LinkTable */ /** \brief create a new LinkTable */

View File

@ -24,15 +24,19 @@ typedef struct {
/** \brief curl shared interface */ /** \brief curl shared interface */
extern CURLSH *curl_share; extern CURLSH *curl_share;
/** \brief perform one transfer cycle */
int curl_multi_perform_once(); int curl_multi_perform_once();
/** \brief Initialise the network module */ /** \brief Initialise the network module */
void network_init(const char *url); void network_init(const char *url);
/** \brief blocking file transfer */
void transfer_blocking(CURL *curl); void transfer_blocking(CURL *curl);
/** \brief non blocking file transfer */
void transfer_nonblocking(CURL *curl); void transfer_nonblocking(CURL *curl);
/** \brief callback function for file transfer */
size_t size_t
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp); WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp);