summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-30 14:49:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-30 14:49:15 (GMT)
commit1f4f47ccf50b4d6518c3dbfd9fd09c7bbb785929 (patch)
tree922d6c60574bcbfc72a4ed59cfe3f8a18ac40334 /library
parentaccd2800ecceb527ff9315ec011511b30f32a980 (diff)
downloadtcl-1f4f47ccf50b4d6518c3dbfd9fd09c7bbb785929.zip
tcl-1f4f47ccf50b4d6518c3dbfd9fd09c7bbb785929.tar.gz
tcl-1f4f47ccf50b4d6518c3dbfd9fd09c7bbb785929.tar.bz2
(slightly) better error-message for invalid http -headers option. This works for plain 8.6 too
Diffstat (limited to 'library')
-rw-r--r--library/http/http.tcl8
1 files changed, 3 insertions, 5 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index abef596..b0f87de 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -733,7 +733,7 @@ proc http::geturl {url args} {
-strict boolean
-timeout integer
-validate boolean
- -headers list
+ -headers dict
}
set state(charset) $defaultCharset
set options {
@@ -747,10 +747,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]) ||
- $flag eq "-headers" && [llength $value] %2 != 0
+ if {($flag eq "-headers") ? [catch {dict size $value}] :
+ ([info exists type($flag)] && ![string is $type($flag) -strict $value])
} {
unset $token
return -code error \