diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-30 15:25:48 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-30 15:25:48 (GMT) |
commit | 438dbdc047dbc22f234da2b77c0ff395fc503bab (patch) | |
tree | f515b3464b21496b520bc6ce33fd4567d11190d8 | |
parent | a24454331a3bdfcf0c0c5919ad315be020b490c9 (diff) | |
parent | cb6ae544245fea42d68f1f1c0c3ab5fd92babcaf (diff) | |
download | tcl-438dbdc047dbc22f234da2b77c0ff395fc503bab.zip tcl-438dbdc047dbc22f234da2b77c0ff395fc503bab.tar.gz tcl-438dbdc047dbc22f234da2b77c0ff395fc503bab.tar.bz2 |
Merge 8.7
-rw-r--r-- | generic/tclInterp.c | 32 | ||||
-rw-r--r-- | library/http/http.tcl | 5 | ||||
-rw-r--r-- | tests/interp.test | 8 |
3 files changed, 28 insertions, 17 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index c990dc0..69d2b13 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -621,36 +621,48 @@ NRInterpCmd( static const char *const options[] = { "alias", "aliases", "bgerror", "cancel", "children", "create", "debug", "delete", - "eval", "exists", "expose", - "hide", "hidden", "issafe", - "invokehidden", "limit", "marktrusted", "recursionlimit", + "eval", "exists", "expose", "hide", + "hidden", "issafe", "invokehidden", + "limit", "marktrusted", "recursionlimit", + "share", #ifndef TCL_NO_DEPRECATED "slaves", #endif + "target", "transfer", NULL + }; + static const char *const optionsNoSlaves[] = { + "alias", "aliases", "bgerror", "cancel", + "children", "create", "debug", "delete", + "eval", "exists", "expose", + "hide", "hidden", "issafe", + "invokehidden", "limit", "marktrusted", "recursionlimit", "share", "target", "transfer", NULL }; enum option { OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_CANCEL, OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE, - OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, - OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE, - OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT, + OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, OPT_HIDE, + OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHID, + OPT_LIMIT, OPT_MARKTRUSTED, OPT_RECLIMIT, OPT_SHARE, #ifndef TCL_NO_DEPRECATED OPT_SLAVES, #endif - OPT_SHARE, OPT_TARGET, OPT_TRANSFER + OPT_TARGET, OPT_TRANSFER }; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObj(NULL, objv[1], options, + "option", 0, &index) != TCL_OK) { + /* Don't report the "slaves" option as possibility */ + Tcl_GetIndexFromObj(interp, objv[1], optionsNoSlaves, + "option", 0, &index); return TCL_ERROR; } - switch ((enum option) index) { + switch ((enum option)index) { case OPT_ALIAS: { Tcl_Interp *parentInterp; diff --git a/library/http/http.tcl b/library/http/http.tcl index 58bbee1..df8fe2d 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -760,9 +760,8 @@ proc http::geturl {url args} { foreach {flag value} $args { if {[regexp -- $pat $flag]} { # Validate numbers - if { - [info exists type($flag)] && - ![string is $type($flag) -strict $value] + if {($flag eq "-headers") ? [catch {dict size $value}] : + ([info exists type($flag)] && ![string is $type($flag) -strict $value]) } { unset $token return -code error \ diff --git a/tests/interp.test b/tests/interp.test index 68e8d20..f428207 100644 --- a/tests/interp.test +++ b/tests/interp.test @@ -32,7 +32,7 @@ test interp-1.1 {options for interp command} -returnCodes error -body { } -result {wrong # args: should be "interp cmd ?arg ...?"} test interp-1.2 {options for interp command} -returnCodes error -body { interp frobox -} -match glob -result {bad option "frobox": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, *share, target, or transfer} +} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer} test interp-1.3 {options for interp command} { interp delete } "" @@ -50,13 +50,13 @@ test interp-1.6 {options for interp command} -returnCodes error -body { } -result {wrong # args: should be "interp children ?path?"} test interp-1.7 {options for interp command} -returnCodes error -body { interp hello -} -match glob -result {bad option "hello": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, *share, target, or transfer} +} -result {bad option "hello": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer} test interp-1.8 {options for interp command} -returnCodes error -body { interp -froboz -} -match glob -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, *share, target, or transfer} +} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer} test interp-1.9 {options for interp command} -returnCodes error -body { interp -froboz -safe -} -match glob -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, *share, target, or transfer} +} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer} test interp-1.10 {options for interp command} -returnCodes error -body { interp target } -result {wrong # args: should be "interp target path alias"} |