summaryrefslogtreecommitdiffstats
path: root/library/http
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-09-29 10:01:31 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-09-29 10:01:31 (GMT)
commitc5c73ec317fce63210aedd53ebda27ebef52bcc3 (patch)
tree7588b6205e9d0852d694d4a92d4dd4b92269b03f /library/http
parent12c66bbcfa19527db6282f77e918b55a734b1451 (diff)
downloadtcl-c5c73ec317fce63210aedd53ebda27ebef52bcc3.zip
tcl-c5c73ec317fce63210aedd53ebda27ebef52bcc3.tar.gz
tcl-c5c73ec317fce63210aedd53ebda27ebef52bcc3.tar.bz2
Correctly check the types of boolean options to http::geturl [Bug 811170]
Diffstat (limited to 'library/http')
-rw-r--r--library/http/http.tcl21
1 files changed, 14 insertions, 7 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index 3854fce..2744eb6 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and
# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: http.tcl,v 1.46 2003/09/15 14:24:50 patthoyts Exp $
+# RCS: @(#) $Id: http.tcl,v 1.47 2003/09/29 10:01:33 dkf Exp $
# Rough version history:
# 1.0 Old http_get interface
@@ -238,7 +238,7 @@ proc http::geturl { url args } {
-binary false
-blocksize 8192
-queryblocksize 8192
- -validate 0
+ -validate false
-headers {}
-timeout 0
-type application/x-www-form-urlencoded
@@ -255,6 +255,14 @@ proc http::geturl { url args } {
status ""
http ""
}
+ # These flags have their types verified [Bug 811170]
+ array set type {
+ -binary boolean
+ -blocksize integer
+ -queryblocksize integer
+ -validate boolean
+ -timeout integer
+ }
set state(charset) $defaultCharset
set options {-binary -blocksize -channel -command -handler -headers \
-progress -query -queryblocksize -querychannel -queryprogress\
@@ -264,12 +272,11 @@ proc http::geturl { url args } {
set pat ^-([join $options |])$
foreach {flag value} $args {
if {[regexp $pat $flag]} {
- # Validate numbers
- if {[info exists state($flag)] && \
- [string is integer -strict $state($flag)] && \
- ![string is integer -strict $value]} {
+ # Validate numbers and booleans
+ if {[info exists type($flag)] && \
+ ![string is $type($flag) -strict $value]} {
unset $token
- return -code error "Bad value for $flag ($value), must be integer"
+ return -code error "Bad value for $flag ($value), must be $type($flag)"
}
set state($flag) $value
} else {