]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: --continue-at is mutually exclusive with --range
authorDaniel Stenberg <daniel@haxx.se>
Mon, 2 Dec 2024 10:53:54 +0000 (11:53 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Dec 2024 14:36:44 +0000 (15:36 +0100)
Allowing both just creates a transfer with behaviors no user can
properly anticipate so better just deny the combo.

Fixes #15646
Reported-by: Harry Sintonen
Closes #15666

docs/cmdline-opts/continue-at.md
docs/cmdline-opts/range.md
src/tool_getparam.c

index 978cafc01f7fe386a8a883ad1ed8ab6c34981a66..e57671c35006d070524e5028f70382ccb337cb39 100644 (file)
@@ -24,3 +24,6 @@ the FTP server command SIZE is not used by curl.
 
 Use "-C -" to instruct curl to automatically find out where/how to resume the
 transfer. It then uses the given output/input files to figure that out.
+
+This command line option is mutually exclusive with --range: you can only use
+one of them for a single transfer.
index c2cee2e1f6ccb8852ef109f58222359264ed17a5..306998cd30c73634ece0e51bddb98b4573ff5f34 100644 (file)
@@ -55,3 +55,6 @@ attempt to get a range, curl instead gets the whole document.
 FTP and SFTP range downloads only support the simple 'start-stop' syntax
 (optionally with one of the numbers omitted). FTP use depends on the extended
 FTP command SIZE.
+
+This command line option is mutually exclusive with --continue-at: you can only
+use one of them for a single transfer.
index 447046f72f866e040b75ec7e45fbd4c22eb5ee50..7c31ca1cb62c5ee6a6689eff6a258d266f483a31 100644 (file)
@@ -1845,6 +1845,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       err = getstr(&config->cookiejar, nextarg, DENY_BLANK);
       break;
     case C_CONTINUE_AT: /* --continue-at */
+      if(config->range) {
+        errorf(global, "--continue-at is mutually exclusive with --range");
+        return PARAM_BAD_USE;
+      }
       /* This makes us continue an ftp transfer at given position */
       if(strcmp(nextarg, "-")) {
         err = str2offset(&config->resume_from, nextarg);
@@ -2397,6 +2401,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       }
       break;
     case C_RANGE: /* --range */
+      if(config->use_resume) {
+        errorf(global, "--continue-at is mutually exclusive with --range");
+        return PARAM_BAD_USE;
+      }
       /* Specifying a range WITHOUT A DASH will create an illegal HTTP range
          (and will not actually be range by definition). The manpage
          previously claimed that to be a good way, why this code is added to