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
HTTPDirFS \- filesystem client for HTTP directory listing
.SH SYNOPSIS
@ -11,12 +11,15 @@ through the FUSE interface. It supports HTTP basic authentication and proxy.
.Sh OPTIONS
.SS "General options:"
.TP
\fB\-f\fR
foreground operation
\fB\-o\fR opt,[opt...]
mount options
.TP
\fB\-s\fR
disable multi\-threaded operation
.SS "Network options:"
\fB\-h\fR \fB\-\-help\fR
print help
.TP
\fB\-V\fR \fB\-\-version\fR
print version
.SS "HTTPDirFS options:"
.TP
\fB\-u\fR \fB\-\-username\fR
HTTP authentication username
@ -34,36 +37,35 @@ Username for the proxy
\fB\-\-proxy\-password\fR
Password for the proxy
.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
Enable cache, by default this is disabled
Enable cache (default: off)
.TP
\fB\-\-cache\-location\fR
Set a custom cache location, by default it is
located in ${XDG_CACHE_HOME}/httpdirfs
Set a custom cache location
(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:"
.TP
\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);
static void print_help(char *program_name, int long_help);
static void print_version();
static void print_http_options();
static void print_long_help();
static int
parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_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;
case 'h':
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 */
return 1;
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);
break;
default:
fprintf(stderr, "Error: Invalid option\n");
add_arg(fuse_argv, fuse_argc, "--help");
fprintf(stderr, "see httpdirfs -h for usage\n");
return 1;
}
break;
default:
fprintf(stderr, "Error: Invalid option\n");
add_arg(fuse_argv, fuse_argc, "--help");
fprintf(stderr, "see httpdirfs -h for usage\n");
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)
{
fprintf(stderr,
"Usage: %s [options] URL mountpoint\n", program_name);
"usage: %s [options] URL mountpoint\n", program_name);
if (long_help) {
print_http_options();
print_long_help();
}
}
@ -244,36 +242,38 @@ static void print_version()
"HTTPDirFS version %s\n", VERSION);
}
static void print_http_options()
static void print_long_help()
{
fprintf(stderr,
"options from HTTPDirFS:\n\
-f foreground operation\n\
-s disable multi-threaded operation\n\
"\n\
general options:\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\
-p --password HTTP authentication password\n\
-P --proxy Proxy for libcurl, for more details refer to\n\
https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html\n\
--proxy-username Username for the proxy\n\
--proxy-password Password for the proxy\n\
--cache Enable cache, by default this is disabled\n\
--cache-location Set a custom cache location, by default it is \n\
located in ${XDG_CACHE_HOME}/httpdirfs \n\
--dl-seg-size The download segment size in MB for the cache,\n\
default to 8MB. Note that specifying download\n\
segment size for existing cache file will not be\n\
honoured. \n\
--max-seg-count The maximum number of download segments a file\n\
can have. By default it is set to 128*1024. This\n\
means the maximum memory usage per file is 128KB.\n\
This allows caching file up to 1TB in size, \n\
assuming you are using the default segment size.\n\
--max-conns The maximum number of network connections that\n\
libcurl is allowed to make, default to 10.\n\
--retry-wait The waiting interval in seconds before making an\n\
HTTP request, after encountering an error, \n\
default to 5 seconds.\n\
--user-agent The user agent string, default to \"HTTPDirFS\".\n\
\n\
other options from libfuse:\n");
--cache Enable cache (default: off)\n\
--cache-location Set a custom cache location\n\
(default: \"${XDG_CACHE_HOME}/httpdirfs\")\n\
--dl-seg-size Set cache download segment size, in MB (default: 8)\n\
Note: this setting is ignored if previously\n\
cached data is found for the requested file.\n\
--max-seg-count Set maximum number of download segments a file\n\
can have. (default: 128*1024)\n\
With the default setting, the maximum memory usage\n\
per file is 128KB. This allows caching files up\n\
to 1TB in size using the default segment size.\n\
--max-conns Set maximum number of network connections that\n\
libcurl is allowed to make. (default: 10)\n\
--retry-wait Set delay in seconds before retrying an HTTP request\n\
after encountering an error. (default: 5)\n\
--user-agent Set user agent string (default: \"HTTPDirFS\")\n\
\n\
");
}