From d6fa269907f590d521bdbc7aa2c2225f3beb3526 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 29 Sep 2003 10:04:52 +0000 Subject: Correctly check the types of boolean options to http::geturl [Bug 811170] --- ChangeLog | 3 +++ library/http/http.tcl | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3726e7..c7bfd12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-09-29 Donal K. Fellows + * library/http/http.tcl (geturl): Correctly check the type of + boolean-valued options. [Bug 811170] + * unix/tcl.m4 (SC_ENABLE_FRAMEWORK): Added note to make it clearer that this is an OSX feature, not a general Unix feature. [Bug 619440] diff --git a/library/http/http.tcl b/library/http/http.tcl index 2a9c8b5..50ecdef 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.43.2.1 2003/07/18 19:41:16 hobbs Exp $ +# RCS: @(#) $Id: http.tcl,v 1.43.2.2 2003/09/29 10:04:53 dkf Exp $ # Rough version history: # 1.0 Old http_get interface @@ -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\ @@ -265,11 +273,10 @@ proc http::geturl { url args } { 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]} { + 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 { -- cgit v0.12