Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Insufficient error handling generates exception

Deleted218998ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:09:07
OriginalBugID: 3752 Bug
Version: 8.2.2
SubmitDate: '1999-12-02'
LastModified: '1999-12-03'
Severity: CRIT
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Solaris
Machine: Sun Ultra Sparc
FixedDate: '1999-12-03'
FixedInVersion: 8.2.3
ClosedDate: '2000-10-25'


Name: Q. Alex Zhao


Comments:

If "catch" catches an error, n is undefined, causing "if {$n == 0} ..." to fail. Use "elseif" should fix the problem.


ReproducibleScript:

Use the http package to fetch a Web page.


ObservedBehavior:

can't read "n": no such variable

    while executing

"if {$n == 0} {

            set state(state) body

            if {![regexp -nocase ^text $state(type)]} {

                # Turn off conversions for non-text data

                fconfigure $s ..."

    (procedure "http::Event" line 14)

    invoked from within

"http::Event ::http::722"


DesiredBehavior:

no error


Patch:

*** http.tcl.old        Fri Nov 19 18:10:08 1999

--- http.tcl    Thu Dec  2 13:13:30 1999

***************

*** 449,456 ****

      if {[string equal $state(state) "header"]} {

        if {[catch {gets $s line} n]} {

            Finish $token $err

!       }

!       if {$n == 0} {

            set state(state) body

            if {![regexp -nocase ^text $state(type)]} {

                # Turn off conversions for non-text data

--- 449,455 ----

      if {[string equal $state(state) "header"]} {

        if {[catch {gets $s line} n]} {

            Finish $token $err

!       } elseif {$n == 0} {

            set state(state) body

            if {![regexp -nocase ^text $state(type)]} {

                # Turn off conversions for non-text data


PatchFiles:

http.tcl




Good fix, wrong problem (user was using 8.1.1 actually).
The necessary fixes have been applied for 8.2.3/8.3. 
-- 12/03/1999 hobbs
welch Deleted ticket [218998ffff]. [History diff]2000-10-26 08:33:08
dgp Ticket [218998ffff]: 3 changes [History diff]2001-04-19 04:44:19
Log in (anonymous is fine) to add a comment.