Loading src/tool_getparam.c +5 −0 Original line number Diff line number Diff line Loading @@ -515,11 +515,13 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ const char *word = ('-' == flag[0]) ? flag + 2 : flag; size_t fnam = strlen(word); int numhits = 0; bool noflagged = FALSE; if(!strncmp(word, "no-", 3)) { /* disable this option but ignore the "no-" part when looking for it */ word += 3; toggle = FALSE; noflagged = TRUE; } for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) { Loading @@ -543,6 +545,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ if(hit < 0) { return PARAM_OPTION_UNKNOWN; } if(noflagged && (aliases[hit].desc != ARG_BOOL)) /* --no- prefixed an option that isn't boolean! */ return PARAM_NO_NOT_BOOLEAN; } else { flag++; /* prefixed with one dash, pass it */ Loading src/tool_getparam.h +2 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -42,6 +42,7 @@ typedef enum { PARAM_NEXT_OPERATION, PARAM_NO_PREFIX, PARAM_NUMBER_TOO_LARGE, PARAM_NO_NOT_BOOLEAN, PARAM_LAST } ParameterError; Loading src/tool_helpers.c +3 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -66,6 +66,8 @@ const char *param2text(int res) return "the given option can't be reversed with a --no- prefix"; case PARAM_NUMBER_TOO_LARGE: return "too large number"; case PARAM_NO_NOT_BOOLEAN: return "used '--no-' for option that isn't a boolean"; default: return "unknown error"; } Loading tests/data/Makefile.inc +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ test289 test290 test291 test292 test293 test294 test295 test296 test297 \ test298 test299 test300 test301 test302 test303 test304 test305 test306 \ test307 test308 test309 test310 test311 test312 test313 test314 test315 \ test316 test317 test318 test319 test320 test321 test322 test323 test324 \ test325 test326 test327 test328 test329 test330 test331 test332 \ test325 test326 test327 test328 test329 test330 test331 test332 test333 \ \ test340 \ \ Loading tests/data/test333 0 → 100644 +35 −0 Original line number Diff line number Diff line <testcase> <info> <keywords> command-line </keywords> </info> # # Server-side <reply> </reply> # # Client-side <client> <server> none </server> <name> Try a non-boolean command line option with --no- </name> <command> --no-proxy "hey" http://%HOSTIP:%HTTPPORT/333 </command> </client> # # Verify data after the test has been "shot" <verify> # detected the bad --no- prefix <errorcode> 2 </errorcode> </verify> </testcase> Loading
src/tool_getparam.c +5 −0 Original line number Diff line number Diff line Loading @@ -515,11 +515,13 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ const char *word = ('-' == flag[0]) ? flag + 2 : flag; size_t fnam = strlen(word); int numhits = 0; bool noflagged = FALSE; if(!strncmp(word, "no-", 3)) { /* disable this option but ignore the "no-" part when looking for it */ word += 3; toggle = FALSE; noflagged = TRUE; } for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) { Loading @@ -543,6 +545,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ if(hit < 0) { return PARAM_OPTION_UNKNOWN; } if(noflagged && (aliases[hit].desc != ARG_BOOL)) /* --no- prefixed an option that isn't boolean! */ return PARAM_NO_NOT_BOOLEAN; } else { flag++; /* prefixed with one dash, pass it */ Loading
src/tool_getparam.h +2 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -42,6 +42,7 @@ typedef enum { PARAM_NEXT_OPERATION, PARAM_NO_PREFIX, PARAM_NUMBER_TOO_LARGE, PARAM_NO_NOT_BOOLEAN, PARAM_LAST } ParameterError; Loading
src/tool_helpers.c +3 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -66,6 +66,8 @@ const char *param2text(int res) return "the given option can't be reversed with a --no- prefix"; case PARAM_NUMBER_TOO_LARGE: return "too large number"; case PARAM_NO_NOT_BOOLEAN: return "used '--no-' for option that isn't a boolean"; default: return "unknown error"; } Loading
tests/data/Makefile.inc +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ test289 test290 test291 test292 test293 test294 test295 test296 test297 \ test298 test299 test300 test301 test302 test303 test304 test305 test306 \ test307 test308 test309 test310 test311 test312 test313 test314 test315 \ test316 test317 test318 test319 test320 test321 test322 test323 test324 \ test325 test326 test327 test328 test329 test330 test331 test332 \ test325 test326 test327 test328 test329 test330 test331 test332 test333 \ \ test340 \ \ Loading
tests/data/test333 0 → 100644 +35 −0 Original line number Diff line number Diff line <testcase> <info> <keywords> command-line </keywords> </info> # # Server-side <reply> </reply> # # Client-side <client> <server> none </server> <name> Try a non-boolean command line option with --no- </name> <command> --no-proxy "hey" http://%HOSTIP:%HTTPPORT/333 </command> </client> # # Verify data after the test has been "shot" <verify> # detected the bad --no- prefix <errorcode> 2 </errorcode> </verify> </testcase>