summaryrefslogtreecommitdiffstats
path: root/tests/http11.test
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2020-07-24 20:32:20 (GMT)
committerkjnash <k.j.nash@usa.net>2020-07-24 20:32:20 (GMT)
commit7c4cabaaae8d1f5b351e2016d56308e2531cca9b (patch)
tree4e13b1a18d91514c5646f451cfbeb57570a4b384 /tests/http11.test
parentc92e694158c082dfec085e17ad6c8552b874267c (diff)
downloadtcl-7c4cabaaae8d1f5b351e2016d56308e2531cca9b.zip
tcl-7c4cabaaae8d1f5b351e2016d56308e2531cca9b.tar.gz
tcl-7c4cabaaae8d1f5b351e2016d56308e2531cca9b.tar.bz2
Fix for bug cb0373bb33. In HTTP/1.1 the response header "Connection", if absent, must default to "keep-alive". Add test http11-1.13 and bump version to 2.9.3.
Diffstat (limited to 'tests/http11.test')
-rw-r--r--tests/http11.test37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/http11.test b/tests/http11.test
index 1e30802..6d93d36 100644
--- a/tests/http11.test
+++ b/tests/http11.test
@@ -60,6 +60,20 @@ proc meta {tok {key ""}} {
return $meta
}
+proc state {tok {key ""}} {
+ upvar 1 $tok state
+ if {$key ne ""} {
+ if {[array names state -exact $key] ne {}} {
+ return $state($key)
+ } else {
+ return ""
+ }
+ }
+ set res [array get state]
+ dict set res body <elided>
+ return $res
+}
+
proc check_crc {tok args} {
set crc [meta $tok x-crc32]
set data [expr {[llength $args] ? [lindex $args 0] : [http::data $tok]}]
@@ -241,6 +255,29 @@ test http11-1.12 "normal,identity,chunked" -setup {
halt_httpd
} -result {ok {HTTP/1.1 200 OK} ok {} chunked}
+test http11-1.13 "normal, 1.1 and keepalive as server default, no zip" -setup {
+ variable httpd [create_httpd]
+ set zipTmp [http::config -zip]
+ http::config -zip 0
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?transfer= \
+ -protocol 1.1 -keepalive 1 -timeout 10000]
+ http::wait $tok
+ set res1 [list [http::status $tok] [http::code $tok] [check_crc $tok] \
+ [meta $tok connection] [meta $tok transfer-encoding] [state $tok reusing] [state $tok connection]]
+ set toj [http::geturl http://localhost:$httpd_port/testdoc.html?transfer= \
+ -protocol 1.1 -keepalive 1 -timeout 10000]
+ http::wait $toj
+ set res2 [list [http::status $toj] [http::code $toj] [check_crc $toj] \
+ [meta $toj connection] [meta $toj transfer-encoding] [state $toj reusing] [state $toj connection]]
+ concat $res1 -- $res2
+} -cleanup {
+ http::cleanup $tok
+ http::cleanup $toj
+ halt_httpd
+ http::config -zip $zipTmp
+} -result {ok {HTTP/1.1 200 OK} ok {} {} 0 keep-alive -- ok {HTTP/1.1 200 OK} ok {} {} 1 keep-alive}
+
# -------------------------------------------------------------------------
test http11-2.0 "-channel" -setup {