diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-09 11:30:09 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-05-09 11:30:09 (GMT) |
commit | 4ba2d9a81ad7f1d8b015c4f3f1dd0e6f603ecc3b (patch) | |
tree | 06b5a47205631b604a40625661f91c5b670a1110 | |
parent | 57d6529dcc314ab996a90d55270e3dae7dc1f92e (diff) | |
parent | 55cb4d9026c1222d6c678bdfa8698f49082bfd92 (diff) | |
download | tcl-4ba2d9a81ad7f1d8b015c4f3f1dd0e6f603ecc3b.zip tcl-4ba2d9a81ad7f1d8b015c4f3f1dd0e6f603ecc3b.tar.gz tcl-4ba2d9a81ad7f1d8b015c4f3f1dd0e6f603ecc3b.tar.bz2 |
Fix [6ca52aec14e0b33543d3cd9895f060b852ac4dbc|6ca52aec14]: HTTP package: Memory leak if client requests "Connection: close" but server responses with "Connection: keep-alive"
http: 2.8.10 -> 2.8.11
-rw-r--r-- | library/http/http.tcl | 9 | ||||
-rw-r--r-- | library/http/pkgIndex.tcl | 2 | ||||
-rw-r--r-- | tests/http.test | 8 | ||||
-rw-r--r-- | unix/Makefile.in | 4 | ||||
-rw-r--r-- | win/Makefile.in | 4 |
5 files changed, 18 insertions, 9 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl index 03751a3..d950441 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -11,7 +11,7 @@ package require Tcl 8.6- # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles -package provide http 2.8.10 +package provide http 2.8.11 namespace eval http { # Allow resourcing to not clobber existing data @@ -206,9 +206,10 @@ proc http::Finish {token {errormsg ""} {skipCB 0}} { set state(error) [list $errormsg $errorInfo $errorCode] set state(status) "error" } - if { - ($state(status) eq "timeout") || ($state(status) eq "error") || - ([info exists state(connection)] && ($state(connection) eq "close")) + if { ($state(status) eq "timeout") + || ($state(status) eq "error") + || ([info exists state(-keepalive)] && !$state(-keepalive)) + || ([info exists state(connection)] && ($state(connection) eq "close")) } { CloseSocket $state(sock) $token } diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl index 841b4eb..a0d28f1 100644 --- a/library/http/pkgIndex.tcl +++ b/library/http/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.6-]} {return} -package ifneeded http 2.8.10 [list tclPkgSetup $dir http 2.8.10 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] +package ifneeded http 2.8.11 [list tclPkgSetup $dir http 2.8.11 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] diff --git a/tests/http.test b/tests/http.test index 12ad475..d7e42c2 100644 --- a/tests/http.test +++ b/tests/http.test @@ -592,6 +592,14 @@ test http-4.15 {http::Event} -body { } -cleanup { catch {http::cleanup $token} } -returnCodes 1 -match glob -result "couldn't open socket*" +test http-1.15 {Leak with Close vs Keepalive (bug [6ca52aec14]} -body { + set before [chan names] + set token [http::geturl $url -headers {X-Connection keep-alive}] + http::cleanup $token + update + set after [chan names] + expr {$before eq $after} +} -result 1 test http-5.1 {http::formatQuery} { http::formatQuery name1 value1 name2 "value two" diff --git a/unix/Makefile.in b/unix/Makefile.in index 9ad106c..fe9ca40 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -840,8 +840,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/http1.0; \ done; - @echo "Installing package http 2.8.10 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/http-2.8.10.tm; + @echo "Installing package http 2.8.11 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/http-2.8.11.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 0ab4204..71df19a 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -651,8 +651,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ done; - @echo "Installing package http 2.8.10 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.10.tm; + @echo "Installing package http 2.8.11 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.11.tm; @echo "Installing library opt0.4 directory"; @for j in $(ROOT_DIR)/library/opt/*.tcl; \ do \ |