From 4d3a8115170564c6159e793451ea25fead36adb6 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 6 Nov 2012 10:40:09 +0000 Subject: [Bug 3581754]: Ensure that http -command callbacks are done at most once. --- ChangeLog | 9 +++++++++ library/http/http.tcl | 16 +++++++--------- library/http/pkgIndex.tcl | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87893c7..d0e6ebd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-11-06 Donal K. Fellows + + * library/http/http.tcl (http::Finish): [Bug 3581754]: Ensure that + callbacks are done at most once to prevent problems with timeouts on a + keep-alive connection (combined with reentrant http package use) + causing excessive stack growth. Not a fix for the underlying problem, + but ensures that pain will be mostly kept away from users. + Bump http package to 2.7.10. + 2012-10-23 Jan Nijtmans * generic/tclInt.h: Remove unused TclpLoadFile function. diff --git a/library/http/http.tcl b/library/http/http.tcl index ce9f634..fa0425d 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -11,7 +11,7 @@ package require Tcl 8.4 # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles -package provide http 2.7.9 +package provide http 2.7.10 namespace eval http { # Allow resourcing to not clobber existing data @@ -199,15 +199,13 @@ proc http::Finish {token {errormsg ""} {skipCB 0}} { if {[info exists state(after)]} { after cancel $state(after) } - if {[info exists state(-command)] && !$skipCB} { - if {[catch {eval $state(-command) {$token}} err]} { - if {$errormsg eq ""} { - set state(error) [list $err $errorInfo $errorCode] - set state(status) error - } + if {[info exists state(-command)] && !$skipCB + && ![info exists state(done-command-cb)]} { + set state(done-command-cb) yes + if {[catch {eval $state(-command) {$token}} err] && $errormsg eq ""} { + set state(error) [list $err $errorInfo $errorCode] + set state(status) error } - # Command callback may already have unset our state - unset -nocomplain state(-command) } } diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl index 815ac12..0b5cdeb 100644 --- a/library/http/pkgIndex.tcl +++ b/library/http/pkgIndex.tcl @@ -1,4 +1,4 @@ # Tcl package index file, version 1.1 if {![package vsatisfies [package provide Tcl] 8.4]} {return} -package ifneeded http 2.7.9 [list tclPkgSetup $dir http 2.7.9 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] +package ifneeded http 2.7.10 [list tclPkgSetup $dir http 2.7.10 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] -- cgit v0.12 From b8016570988da571cbac3d951faa78b548ab96ad Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Nov 2012 16:14:54 +0000 Subject: complete bump to http 2.7.10 --- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index a2d89aa..87deb20 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -766,8 +766,8 @@ install-libraries: libraries $(INSTALL_TZDATA) install-msgs do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/http1.0; \ done; - @echo "Installing package http 2.7.9 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/http-2.7.9.tm; + @echo "Installing package http 2.7.10 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/http-2.7.10.tm; @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/"; @for i in $(TOP_DIR)/library/opt/*.tcl ; \ do \ diff --git a/win/Makefile.in b/win/Makefile.in index b0bdec8..bfc7c57 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -637,8 +637,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ done; - @echo "Installing package http 2.7.9 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/http-2.7.9.tm; + @echo "Installing package http 2.7.10 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/http-2.7.10.tm; @echo "Installing library opt0.4 directory"; @for j in $(ROOT_DIR)/library/opt/*.tcl; \ do \ -- cgit v0.12 From 07bc7f6239dbbfb01001aacdfaece126250e1965 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Nov 2012 16:20:27 +0000 Subject: changes update --- changes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changes b/changes index 820bcb3..ee21461 100644 --- a/changes +++ b/changes @@ -7678,4 +7678,7 @@ Many revisions to better support a Cygwin environment (nijtmans) 2012-10-14 (bug fix) [tcl::Bgerror] crash on non-dict options (nijtmans) +2012-11-06 (bug fix)[3581754] avoid multiple callback on keep-alive (fellows) +=> http 2.7.10 + --- Released 8.5.13, November 12, 2012 --- See ChangeLog for details --- -- cgit v0.12