diff --git a/src/link.c b/src/link.c index 1cfa14c..3cc9f0b 100644 --- a/src/link.c +++ b/src/link.c @@ -735,10 +735,12 @@ long path_download(const char *path, char *output_buf, size_t size, transfer_blocking(curl); /* Check for range seek support */ - if (!strcasestr((header.data), "Accept-Ranges: bytes")) { - fprintf(stderr, "Error: This web server does not support HTTP \ + if (!CONFIG.no_range_check) { + if (!strcasestr((header.data), "Accept-Ranges: bytes")) { + fprintf(stderr, "Error: This web server does not support HTTP \ range requests\n"); - exit(EXIT_FAILURE); + exit(EXIT_FAILURE); + } } free(header.data); diff --git a/src/main.c b/src/main.c index 0716f9d..55c6110 100644 --- a/src/main.c +++ b/src/main.c @@ -72,7 +72,7 @@ int main(int argc, char **argv) CONFIG.sonic_mode = 1; } else if (CONFIG.sonic_username || CONFIG.sonic_password) { fprintf(stderr, - "Error: You have to supply both username and password to\ + "Error: You have to supply both username and password to \ activate Sonic mode.\n"); exit(EXIT_FAILURE); } @@ -151,7 +151,8 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) {"cache-location", required_argument, NULL, 'L'}, /* 14 */ {"sonic-username", required_argument, NULL, 'L'}, /* 15 */ {"sonic-password", required_argument, NULL, 'L'}, /* 16 */ - {"sonic-id3", no_argument, NULL, 'L'}, /* 17 */ + {"sonic-id3", no_argument, NULL, 'L'}, /* 17 */ + {"no-range-check", no_argument, NULL, 'L'}, /* 18 */ {0, 0, 0, 0} }; while ((c = @@ -228,6 +229,9 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc) case 17: CONFIG.sonic_id3 = 1; break; + case 18: + CONFIG.no_range_check = 1; + break; default: fprintf(stderr, "see httpdirfs -h for usage\n"); return 1; @@ -300,6 +304,8 @@ HTTPDirFS options:\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\ + --no-range-check Disable the build-in check for the server's support\n\ + for HTTP range requests\n\ \n\ For mounting a Airsonic / Subsonic server:\n\ --sonic-username The username for your Airsonic / Subsonic server\n\ diff --git a/src/sonic.c b/src/sonic.c index 086d094..a818e3d 100644 --- a/src/sonic.c +++ b/src/sonic.c @@ -11,7 +11,6 @@ #include #include - typedef struct { char *server; char *username; diff --git a/src/util.c b/src/util.c index 4c4d216..7c723a8 100644 --- a/src/util.c +++ b/src/util.c @@ -72,6 +72,8 @@ void Config_init(void) CONFIG.http_wait_sec = DEFAULT_HTTP_WAIT_SEC; + CONFIG.no_range_check = 0; + /*--------------- Cache related ---------------*/ CONFIG.cache_enabled = 0; diff --git a/src/util.h b/src/util.h index e5877e9..2b87ce3 100644 --- a/src/util.h +++ b/src/util.h @@ -53,6 +53,8 @@ typedef struct { char *user_agent; /** \brief The waiting time after getting HTTP 429 (too many requests) */ int http_wait_sec; + /** \brief Disable check for the server's support of HTTP range request */ + int no_range_check; /** \brief Whether cache mode is enabled */ int cache_enabled;