summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-07-27 21:30:27 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-07-27 21:30:27 (GMT)
commitd3aaff6a4e6f527b39013fbc221f5091adae6439 (patch)
treed99bed0a235f91424c4d6d7fc8d50e973377e280 /library
parent64996d4c1ad62d3338b5c087e742d85dd2a4c15c (diff)
parent493182df76dae588330e4c30d0f876a254f1fd8d (diff)
downloadtcl-d3aaff6a4e6f527b39013fbc221f5091adae6439.zip
tcl-d3aaff6a4e6f527b39013fbc221f5091adae6439.tar.gz
tcl-d3aaff6a4e6f527b39013fbc221f5091adae6439.tar.bz2
merge 8.6
Diffstat (limited to 'library')
-rw-r--r--library/http/http.tcl33
-rw-r--r--library/http/pkgIndex.tcl2
2 files changed, 29 insertions, 6 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index a93e67b..f9ec8ca 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.9.2
+package provide http 2.9.3
namespace eval http {
# Allow resourcing to not clobber existing data
@@ -721,7 +721,7 @@ proc http::geturl {url args} {
body {}
status ""
http ""
- connection close
+ connection keep-alive
}
set state(-keepalive) $defaultKeepalive
set state(-strict) $strict
@@ -1037,7 +1037,7 @@ proc http::geturl {url args} {
}
# Do not automatically close the connection socket.
- set state(connection) {}
+ set state(connection) keep-alive
}
}
@@ -2688,8 +2688,31 @@ proc http::Event {sock token} {
}
proxy-connection -
connection {
- set state(connection) \
- [string trim [string tolower $value]]
+ set tmpHeader [string trim [string tolower $value]]
+ # RFC 7230 Section 6.1 states that a comma-separated
+ # list is an acceptable value. According to
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
+ # any comma-separated list implies keep-alive, but I
+ # don't see this in the RFC so we'll play safe and
+ # scan any list for "close".
+ if {$tmpHeader in {close keep-alive}} {
+ # The common cases, continue.
+ } elseif {[string first , $tmpHeader] == -1} {
+ # Not a comma-separated list, not "close",
+ # therefore "keep-alive".
+ set tmpHeader keep-alive
+ } else {
+ set tmpHeader keep-alive
+ set tmpCsl [split $tmpHeader ,]
+ # Optional whitespace either side of separator.
+ foreach el $tmpCsl {
+ if {[string trim $el] eq {close}} {
+ set tmpHeader close
+ break
+ }
+ }
+ }
+ set state(connection) $tmpHeader
}
}
lappend state(meta) $key [string trim $value]
diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl
index 4f5eafb..43cd86b 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.9.2 [list tclPkgSetup $dir http 2.9.2 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]
+package ifneeded http 2.9.3 [list tclPkgSetup $dir http 2.9.3 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}]