summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-26 16:52:06 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-26 16:52:06 (GMT)
commit33c33747236b588a0fb278f6ab9a37e824b06f1c (patch)
treeca8a4db8859ded6152ed1e780ed6f5d34c32fd42 /library
parent05f25dff9f24bc4c88cdb93d6d8e6db3fa2e9e89 (diff)
parent6cc6771848666666ce1156ea385c04ddb1ce1a1c (diff)
downloadtcl-33c33747236b588a0fb278f6ab9a37e824b06f1c.zip
tcl-33c33747236b588a0fb278f6ab9a37e824b06f1c.tar.gz
tcl-33c33747236b588a0fb278f6ab9a37e824b06f1c.tar.bz2
Merge 8.7
Diffstat (limited to 'library')
-rw-r--r--library/http/http.tcl33
-rw-r--r--library/http/pkgIndex.tcl2
-rw-r--r--library/manifest.txt2
3 files changed, 30 insertions, 7 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index a7ed771..2cef614 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
@@ -734,7 +734,7 @@ proc http::geturl {url args} {
body {}
status ""
http ""
- connection close
+ connection keep-alive
}
set state(-keepalive) $defaultKeepalive
set state(-strict) $strict
@@ -1054,7 +1054,7 @@ proc http::geturl {url args} {
}
# Do not automatically close the connection socket.
- set state(connection) {}
+ set state(connection) keep-alive
}
}
@@ -2725,8 +2725,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
}
set-cookie {
if {$http(-cookiejar) ne ""} {
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}}}]
diff --git a/library/manifest.txt b/library/manifest.txt
index 5ae0eb7..3a7ba54 100644
--- a/library/manifest.txt
+++ b/library/manifest.txt
@@ -5,7 +5,7 @@ apply {{dir} {
set ::test [info script]
set isafe [interp issafe]
foreach {safe package version file} {
- 0 http 2.9.2 {http http.tcl}
+ 0 http 2.9.3 {http http.tcl}
1 msgcat 1.7.1 {msgcat msgcat.tcl}
1 opt 0.4.7 {opt optparse.tcl}
0 cookiejar 0.2.0 {cookiejar cookiejar.tcl}