Merge branch 'master' of github.com:fangfufu/httpdirfs

This commit is contained in:
Fufu Fang 2019-08-23 23:21:26 +01:00
commit e409e816eb
2 changed files with 67 additions and 65 deletions

View File

@ -1,4 +1,4 @@
.TH HTTPDIRFS "1" "July 2019" "HTTPDirFS version 1.1.6" "User Commands" .TH HTTPDIRFS "1" "August 2019" "HTTPDirFS version 1.1.6" "User Commands"
.SH NAME .SH NAME
HTTPDirFS \- filesystem client for HTTP directory listing HTTPDirFS \- filesystem client for HTTP directory listing
.SH SYNOPSIS .SH SYNOPSIS
@ -11,12 +11,15 @@ through the FUSE interface. It supports HTTP basic authentication and proxy.
.Sh OPTIONS .Sh OPTIONS
.SS "General options:" .SS "General options:"
.TP .TP
\fB\-f\fR \fB\-o\fR opt,[opt...]
foreground operation mount options
.TP .TP
\fB\-s\fR \fB\-h\fR \fB\-\-help\fR
disable multi\-threaded operation print help
.SS "Network options:" .TP
\fB\-V\fR \fB\-\-version\fR
print version
.SS "HTTPDirFS options:"
.TP .TP
\fB\-u\fR \fB\-\-username\fR \fB\-u\fR \fB\-\-username\fR
HTTP authentication username HTTP authentication username
@ -34,36 +37,35 @@ Username for the proxy
\fB\-\-proxy\-password\fR \fB\-\-proxy\-password\fR
Password for the proxy Password for the proxy
.TP .TP
\fB\-\-dl\-seg\-size\fR
The size of each download segment in MB,
default to 8MB.
.TP
\fB\-\-max\-seg\-count\fR
The maximum number of download segments a file
can have. By default it is set to 128*1024. This
means the maximum memory usage per file is 128KB.
This allows caching file up to 1TB in size,
assuming you are using the default segment size.
.TP
\fB\-\-max\-conns\fR
The maximum number of network connections that
libcurl is allowed to make, default to 10.
.TP
\fB\-\-retry\-wait\fR
The waiting interval in seconds before making an
HTTP request, after encountering an error,
default to 5 seconds.
.TP
\fB\-\-user\-agent\fR
The user agent string, default to "HTTPDirFS".
.SS "Cache options:"
.TP
\fB\-\-cache\fR \fB\-\-cache\fR
Enable cache, by default this is disabled Enable cache (default: off)
.TP .TP
\fB\-\-cache\-location\fR \fB\-\-cache\-location\fR
Set a custom cache location, by default it is Set a custom cache location
located in ${XDG_CACHE_HOME}/httpdirfs (default: "${XDG_CACHE_HOME}/httpdirfs")
.TP
\fB\-\-dl\-seg\-size\fR
Set cache download segment size, in MB (default: 8)
Note: this setting is ignored if previously
cached data is found for the requested file.
.TP
\fB\-\-max\-seg\-count\fR
Set maximum number of download segments a file
can have. (default: 128*1024)
With the default setting, the maximum memory usage
per file is 128KB. This allows caching files up
to 1TB in size using the default segment size.
.TP
\fB\-\-max\-conns\fR
Set maximum number of network connections that
libcurl is allowed to make. (default: 10)
.TP
\fB\-\-retry\-wait\fR
Set delay in seconds before retrying an HTTP request
after encountering an error. (default: 5)
.TP
\fB\-\-user\-agent\fR
Set user agent string (default: "HTTPDirFS")
.SS "FUSE options:" .SS "FUSE options:"
.TP .TP
\fB\-d\fR \fB\-o\fR debug \fB\-d\fR \fB\-o\fR debug

View File

@ -10,7 +10,7 @@
void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string); void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string);
static void print_help(char *program_name, int long_help); static void print_help(char *program_name, int long_help);
static void print_version(); static void print_version();
static void print_http_options(); static void print_long_help();
static int static int
parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc); parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc);
void parse_config_file(char ***argv, int *argc); void parse_config_file(char ***argv, int *argc);
@ -147,7 +147,7 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc)
break; break;
case 'h': case 'h':
print_help(argv[0], 1); print_help(argv[0], 1);
add_arg(fuse_argv, fuse_argc, "-h"); add_arg(fuse_argv, fuse_argc, "-ho");
/* skip everything else to print the help */ /* skip everything else to print the help */
return 1; return 1;
case 'V': case 'V':
@ -203,14 +203,12 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc)
NETWORK_CONFIG.cache_dir = strdup(optarg); NETWORK_CONFIG.cache_dir = strdup(optarg);
break; break;
default: default:
fprintf(stderr, "Error: Invalid option\n"); fprintf(stderr, "see httpdirfs -h for usage\n");
add_arg(fuse_argv, fuse_argc, "--help");
return 1; return 1;
} }
break; break;
default: default:
fprintf(stderr, "Error: Invalid option\n"); fprintf(stderr, "see httpdirfs -h for usage\n");
add_arg(fuse_argv, fuse_argc, "--help");
return 1; return 1;
} }
}; };
@ -232,9 +230,9 @@ void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string)
static void print_help(char *program_name, int long_help) static void print_help(char *program_name, int long_help)
{ {
fprintf(stderr, fprintf(stderr,
"Usage: %s [options] URL mountpoint\n", program_name); "usage: %s [options] URL mountpoint\n", program_name);
if (long_help) { if (long_help) {
print_http_options(); print_long_help();
} }
} }
@ -244,36 +242,38 @@ static void print_version()
"HTTPDirFS version %s\n", VERSION); "HTTPDirFS version %s\n", VERSION);
} }
static void print_http_options() static void print_long_help()
{ {
fprintf(stderr, fprintf(stderr,
"options from HTTPDirFS:\n\ "\n\
-f foreground operation\n\ general options:\n\
-s disable multi-threaded operation\n\ -o opt,[opt...] mount options\n\
-h --help print help\n\
-V --version print version\n\
\n\
HTTPDirFS options:\n\
-u --username HTTP authentication username\n\ -u --username HTTP authentication username\n\
-p --password HTTP authentication password\n\ -p --password HTTP authentication password\n\
-P --proxy Proxy for libcurl, for more details refer to\n\ -P --proxy Proxy for libcurl, for more details refer to\n\
https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html\n\ https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html\n\
--proxy-username Username for the proxy\n\ --proxy-username Username for the proxy\n\
--proxy-password Password for the proxy\n\ --proxy-password Password for the proxy\n\
--cache Enable cache, by default this is disabled\n\ --cache Enable cache (default: off)\n\
--cache-location Set a custom cache location, by default it is \n\ --cache-location Set a custom cache location\n\
located in ${XDG_CACHE_HOME}/httpdirfs \n\ (default: \"${XDG_CACHE_HOME}/httpdirfs\")\n\
--dl-seg-size The download segment size in MB for the cache,\n\ --dl-seg-size Set cache download segment size, in MB (default: 8)\n\
default to 8MB. Note that specifying download\n\ Note: this setting is ignored if previously\n\
segment size for existing cache file will not be\n\ cached data is found for the requested file.\n\
honoured. \n\ --max-seg-count Set maximum number of download segments a file\n\
--max-seg-count The maximum number of download segments a file\n\ can have. (default: 128*1024)\n\
can have. By default it is set to 128*1024. This\n\ With the default setting, the maximum memory usage\n\
means the maximum memory usage per file is 128KB.\n\ per file is 128KB. This allows caching files up\n\
This allows caching file up to 1TB in size, \n\ to 1TB in size using the default segment size.\n\
assuming you are using the default segment size.\n\ --max-conns Set maximum number of network connections that\n\
--max-conns The maximum number of network connections that\n\ libcurl is allowed to make. (default: 10)\n\
libcurl is allowed to make, default to 10.\n\ --retry-wait Set delay in seconds before retrying an HTTP request\n\
--retry-wait The waiting interval in seconds before making an\n\ after encountering an error. (default: 5)\n\
HTTP request, after encountering an error, \n\ --user-agent Set user agent string (default: \"HTTPDirFS\")\n\
default to 5 seconds.\n\ \n\
--user-agent The user agent string, default to \"HTTPDirFS\".\n\ ");
\n\
other options from libfuse:\n");
} }