Revert "Update to 7.44.0"
[platform/upstream/curl.git] / src / tool_getparam.c
index 4405bce..5b60c9c 100644 (file)
@@ -145,7 +145,7 @@ static const struct LongShort aliases[]= {
   {"$v", "ssl-reqd",                 FALSE},
          /* 'ssl-reqd' new in 7.20.0, previously this was ftp-ssl-reqd */
   {"$w", "sessionid",                FALSE},
-         /* 'sessionid' listed as --no-sessionid in the help */
+         /* ยกsessionid' listed as --no-sessionid in the help */
   {"$x", "ftp-ssl-control",          FALSE},
   {"$y", "ftp-ssl-ccc",              FALSE},
   {"$j", "ftp-ssl-ccc-mode",         TRUE},
@@ -158,10 +158,10 @@ static const struct LongShort aliases[]= {
   {"$3", "keepalive-time",           TRUE},
   {"$4", "post302",                  FALSE},
   {"$5", "noproxy",                  TRUE},
+#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
   {"$6", "socks5-gssapi-service",    TRUE},
   {"$7", "socks5-gssapi-nec",        FALSE},
-  {"$O", "proxy-service-name",       TRUE},
-  {"$P", "service-name",             TRUE},
+#endif
   {"$8", "proxy1.0",                 TRUE},
   {"$9", "tftp-blksize",             TRUE},
   {"$A", "mail-from",                TRUE},
@@ -177,7 +177,6 @@ static const struct LongShort aliases[]= {
   {"$K", "sasl-ir",                  FALSE},
   {"$L", "test-event",               FALSE},
   {"$M", "unix-socket",              TRUE},
-  {"$N", "path-as-is",               FALSE},
   {"0",   "http1.0",                 FALSE},
   {"01",  "http1.1",                 FALSE},
   {"02",  "http2",                   FALSE},
@@ -196,7 +195,6 @@ static const struct LongShort aliases[]= {
   {"c",  "cookie-jar",               TRUE},
   {"C",  "continue-at",              TRUE},
   {"d",  "data",                     TRUE},
-  {"dr", "data-raw",                 TRUE},
   {"da", "data-ascii",               TRUE},
   {"db", "data-binary",              TRUE},
   {"de", "data-urlencode",           TRUE},
@@ -220,8 +218,6 @@ static const struct LongShort aliases[]= {
   {"Eo", "login-options",            TRUE},
   {"Ep", "pinnedpubkey",             TRUE},
   {"Eq", "cert-status",              FALSE},
-  {"Er", "false-start",              FALSE},
-  {"Es", "ssl-no-revoke",            FALSE},
   {"f",  "fail",                     FALSE},
   {"F",  "form",                     TRUE},
   {"Fs", "form-string",              TRUE},
@@ -527,7 +523,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       case 'g': /* --trace */
         GetStr(&global->trace_dump, nextarg);
         if(global->tracetype && (global->tracetype != TRACE_BIN))
-          warnf(global, "--trace overrides an earlier trace/verbose option\n");
+          warnf(config, "--trace overrides an earlier trace/verbose option\n");
         global->tracetype = TRACE_BIN;
         break;
       case 'G': /* --npn */
@@ -536,7 +532,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       case 'h': /* --trace-ascii */
         GetStr(&global->trace_dump, nextarg);
         if(global->tracetype && (global->tracetype != TRACE_ASCII))
-          warnf(global,
+          warnf(config,
                 "--trace-ascii overrides an earlier trace/verbose option\n");
         global->tracetype = TRACE_ASCII;
         break;
@@ -572,7 +568,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
           /* for plain bytes, leave as-is */
           break;
         default:
-          warnf(global, "unsupported rate unit. Use G, M, K or B!\n");
+          warnf(config, "unsupported rate unit. Use G, M, K or B!\n");
           return PARAM_BAD_USE;
         }
         config->recvpersecond = value;
@@ -680,9 +676,9 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
 
       case 'v': /* --stderr */
         if(strcmp(nextarg, "-")) {
-          FILE *newfile = fopen(nextarg, FOPEN_WRITETEXT);
+          FILE *newfile = fopen(nextarg, "wt");
           if(!newfile)
-            warnf(global, "Failed to open %s!\n", nextarg);
+            warnf(config, "Failed to open %s!\n", nextarg);
           else {
             if(global->errors_fopened)
               fclose(global->errors);
@@ -834,7 +830,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         else {
           config->localportrange -= config->localport;
           if(config->localportrange < 1) {
-            warnf(global, "bad range input\n");
+            warnf(config, "bad range input\n");
             return PARAM_BAD_USE;
           }
         }
@@ -866,7 +862,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         break;
       case 'z': /* --libcurl */
 #ifdef CURL_DISABLE_LIBCURL_OPTION
-        warnf(global,
+        warnf(config,
               "--libcurl option was disabled at build-time!\n");
         return PARAM_OPTION_UNKNOWN;
 #else
@@ -897,18 +893,14 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         /* This specifies the noproxy list */
         GetStr(&config->noproxy, nextarg);
         break;
+#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
       case '6': /* --socks5-gssapi-service */
         GetStr(&config->socks5_gssapi_service, nextarg);
         break;
       case '7': /* --socks5-gssapi-nec*/
         config->socks5_gssapi_nec = toggle;
         break;
-      case 'O': /* --proxy-service-name */
-        GetStr(&config->proxy_service_name, nextarg);
-        break;
-      case 'P': /* --service-name */
-        GetStr(&config->service_name, nextarg);
-        break;
+#endif
       case '8': /* --proxy1.0 */
         /* http 1.0 proxy */
         GetStr(&config->proxy, nextarg);
@@ -958,7 +950,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
           int mlmaj, mlmin, mlpatch;
           metalink_get_version(&mlmaj, &mlmin, &mlpatch);
           if((mlmaj*10000)+(mlmin*100)+mlpatch < CURL_REQ_LIBMETALINK_VERS) {
-            warnf(global,
+            warnf(config,
                   "--metalink option cannot be used because the version of "
                   "the linked libmetalink library is too old. "
                   "Required: %d.%d.%d, found %d.%d.%d\n",
@@ -971,7 +963,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
           else
             config->use_metalink = toggle;
 #else
-          warnf(global, "--metalink option is ignored because the binary is "
+          warnf(config, "--metalink option is ignored because the binary is "
                 "built without the Metalink support.\n");
 #endif
           break;
@@ -983,15 +975,12 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
 #ifdef CURLDEBUG
         config->test_event_based = toggle;
 #else
-        warnf(global, "--test-event is ignored unless a debug build!\n");
+        warnf(config, "--test-event is ignored unless a debug build!\n");
 #endif
         break;
       case 'M': /* --unix-socket */
         GetStr(&config->unix_socket_path, nextarg);
         break;
-      case 'N': /* --path-as-is */
-        config->path_as_is = toggle;
-        break;
       }
       break;
     case '#': /* --progress-bar */
@@ -1105,7 +1094,6 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       char *postdata = NULL;
       FILE *file;
       size_t size = 0;
-      bool raw_mode = (subletter == 'r');
 
       if(subletter == 'e') { /* --data-urlencode*/
         /* [name]=[content], we encode the content part only
@@ -1131,6 +1119,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         }
         if('@' == is_file) {
           /* a '@' letter, it means that a file name or - (stdin) follows */
+
           if(curlx_strequal("-", p)) {
             file = stdin;
             set_binmode(stdin);
@@ -1138,7 +1127,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
           else {
             file = fopen(p, "rb");
             if(!file)
-              warnf(global,
+              warnf(config,
                     "Couldn't read data from file \"%s\", this makes "
                     "an empty POST.\n", nextarg);
           }
@@ -1191,7 +1180,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
             return PARAM_NO_MEM;
         }
       }
-      else if('@' == *nextarg && !raw_mode) {
+      else if('@' == *nextarg) {
         /* the data begins with a '@' letter, it means that a file name
            or - (stdin) follows */
         nextarg++; /* pass the @ */
@@ -1204,7 +1193,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         else {
           file = fopen(nextarg, "rb");
           if(!file)
-            warnf(global, "Couldn't read data from file \"%s\", this makes "
+            warnf(config, "Couldn't read data from file \"%s\", this makes "
                   "an empty POST.\n", nextarg);
         }
 
@@ -1321,7 +1310,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         break;
       case 'f': /* crypto engine */
         GetStr(&config->engine, nextarg);
-        if(config->engine && curlx_raw_equal(config->engine, "list"))
+        if(config->engine && curlx_raw_equal(config->engine,"list"))
           return PARAM_ENGINES_REQUESTED;
         break;
       case 'g': /* CA info PEM file */
@@ -1379,15 +1368,6 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         config->verifystatus = TRUE;
         break;
 
-      case 'r': /* --false-start */
-        config->falsestart = TRUE;
-        break;
-
-      case 's': /* --ssl-no-revoke */
-        if(curlinfo->features & CURL_VERSION_SSL)
-          config->ssl_no_revoke = TRUE;
-        break;
-
       default: /* certificate file */
       {
         char *certname, *passphrase;
@@ -1461,7 +1441,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       break;
     case 'J': /* --remote-header-name */
       if(config->include_headers) {
-        warnf(global,
+        warnf(config,
               "--include and --remote-header-name cannot be combined.\n");
         return PARAM_BAD_USE;
       }
@@ -1472,7 +1452,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       break;
     case 'K': /* parse config file */
       if(parseconfig(nextarg, global))
-        warnf(global, "error trying read config from the '%s' file\n",
+        warnf(config, "error trying read config from the '%s' file\n",
               nextarg);
       break;
     case 'l':
@@ -1499,7 +1479,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
 #ifdef USE_MANUAL
         return PARAM_MANUAL_REQUESTED;
 #else
-        warnf(global,
+        warnf(config,
               "built-in manual was disabled at build-time!\n");
         return PARAM_OPTION_UNKNOWN;
 #endif
@@ -1618,7 +1598,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       if(ISDIGIT(*nextarg) && !strchr(nextarg, '-')) {
         char buffer[32];
         curl_off_t off;
-        warnf(global,
+        warnf(config,
               "A specified range MUST include at least one dash (-). "
               "Appending one for you!\n");
         off = curlx_strtoofft(nextarg, NULL, 10);
@@ -1634,7 +1614,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         tmp_range = nextarg;
         while(*tmp_range != '\0') {
           if(!ISDIGIT(*tmp_range) && *tmp_range != '-' && *tmp_range != ',') {
-            warnf(global, "Invalid character is found in given range. "
+            warnf(config,"Invalid character is found in given range. "
                   "A specified range MUST have only digits in "
                   "\'start\'-\'stop\'. The server's response to this "
                   "request is uncertain.\n");
@@ -1723,7 +1703,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         if(!global->trace_dump)
           return PARAM_NO_MEM;
         if(global->tracetype && (global->tracetype != TRACE_PLAIN))
-          warnf(global,
+          warnf(config,
                 "-v, --verbose overrides an earlier trace/verbose option\n");
         global->tracetype = TRACE_PLAIN;
       }
@@ -1750,7 +1730,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         }
         else {
           fname = nextarg;
-          file = fopen(nextarg, FOPEN_READTEXT);
+          file = fopen(nextarg, "r");
         }
         err = file2string(&config->writeout, file);
         if(file && (file != stdin))
@@ -1758,7 +1738,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         if(err)
           return err;
         if(!config->writeout)
-          warnf(global, "Failed to read %s", fname);
+          warnf(config, "Failed to read %s", fname);
       }
       else
         GetStr(&config->writeout, nextarg);
@@ -1816,7 +1796,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
         if(-1 == stat(nextarg, &statbuf)) {
           /* failed, remove time condition */
           config->timecond = CURL_TIMECOND_NONE;
-          warnf(global,
+          warnf(config,
                 "Illegal date format for -z, --timecond (and not "
                 "a file name). Disabling time condition. "
                 "See curl_getdate(3) for valid date syntax.\n");