]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: add warning for incompatible parameters usage
authorCao ZhenXiang <caozhenxiang@protonmail.com>
Sun, 5 Sep 2021 05:04:38 +0000 (13:04 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Sep 2021 14:59:08 +0000 (16:59 +0200)
--continue-at - and --remote-header-name are known incompatible parameters

Closes #7674

src/tool_getparam.c

index 00e9542b3b78455ec922f54992eea18487f01637..56fc35cf508d78f2f5b87efd130da810449b8820 100644 (file)
@@ -1890,11 +1890,6 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       }
       break;
     case 'i':
-      if(config->content_disposition) {
-        warnf(global,
-              "--include and --remote-header-name cannot be combined.\n");
-        return PARAM_BAD_USE;
-      }
       config->show_headers = toggle; /* show the headers as well in the
                                         general output stream */
       break;
@@ -1910,11 +1905,6 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         return PARAM_BAD_USE;
       break;
     case 'J': /* --remote-header-name */
-      if(config->show_headers) {
-        warnf(global,
-              "--include and --remote-header-name cannot be combined.\n");
-        return PARAM_BAD_USE;
-      }
       config->content_disposition = toggle;
       break;
     case 'k': /* allow insecure SSL connects */
@@ -2394,6 +2384,19 @@ ParameterError parse_args(struct GlobalConfig *global, int argc,
       curlx_unicodefree(orig_opt);
   }
 
+  if(config->content_disposition) {
+    if(config->show_headers) {
+      helpf(global->errors, "--include and --remote-header-name "
+            "cannot be combined.\n");
+      return PARAM_BAD_USE;
+    }
+    if(config->resume_from_current) {
+      helpf(global->errors, "--continue-at - and --remote-header-name "
+            "cannot be combined.\n");
+      return PARAM_BAD_USE;
+    }
+  }
+
   if(result && result != PARAM_HELP_REQUESTED &&
      result != PARAM_MANUAL_REQUESTED &&
      result != PARAM_VERSION_INFO_REQUESTED &&