Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fangfufu/httpdirfs
Browse files Browse the repository at this point in the history
  • Loading branch information
fangfufu committed Aug 23, 2019
2 parents 23611b8 + 2165419 commit e409e81
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 59 deletions.
56 changes: 29 additions & 27 deletions doc/man/httpdirfs.1
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -34,36 +37,35 @@ Username for the proxy
\fB\-\-proxy\-password\fR
Password for the proxy
.TP
\fB\-\-cache\fR
Enable cache (default: off)
.TP
\fB\-\-cache\-location\fR
Set a custom cache location
(default: "${XDG_CACHE_HOME}/httpdirfs")
.TP
\fB\-\-dl\-seg\-size\fR
The size of each download segment in MB,
default to 8MB.
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
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.
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
The maximum number of network connections that
libcurl is allowed to make, default to 10.
Set maximum number of network connections that
libcurl is allowed to make. (default: 10)
.TP
\fB\-\-retry\-wait\fR
The waiting interval in seconds before making an
HTTP request, after encountering an error,
default to 5 seconds.
Set delay in seconds before retrying an HTTP request
after encountering an error. (default: 5)
.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
.TP
\fB\-\-cache\-location\fR
Set a custom cache location, by default it is
located in ${XDG_CACHE_HOME}/httpdirfs
Set user agent string (default: "HTTPDirFS")
.SS "FUSE options:"
.TP
\fB\-d\fR \fB\-o\fR debug
Expand Down
64 changes: 32 additions & 32 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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;
}
};
Expand All @@ -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();
}
}

Expand All @@ -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\
");
}

0 comments on commit e409e81

Please sign in to comment.