summaryrefslogtreecommitdiffstats
path: root/tests/http11.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/http11.test')
-rw-r--r--tests/http11.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/http11.test b/tests/http11.test
index 762788e..240bfef 100644
--- a/tests/http11.test
+++ b/tests/http11.test
@@ -626,6 +626,33 @@ test http11-3.3 "-handler,keepalive,chunked" -setup {
halt_httpd
} -result {ok {HTTP/1.0 200 OK} ok close {} {} 0}
+# http11-3.4
+# This test is a blatant attempt to confuse the client by instructing the server
+# to send neither "Connection: close" nor "Content-Length" when in non-chunked
+# mode.
+# The client has no way to know the response-body is complete unless the
+# server signals this by closing the connection.
+# In an HTTP/1.1 response the absence of "Connection: close" means
+# "Connection: keep-alive", i.e. the server will keep the connection
+# open. In HTTP/1.0 this is not the case, and this is a test that
+# the Tcl client assumes "Connection: close" by default in HTTP/1.0.
+test http11-3.4 "-handler,close,identity; HTTP/1.0 server does not send Connection: close header or Content-Length" -setup {
+ variable httpd [create_httpd]
+ set testdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1&nosendclose=any \
+ -timeout 10000 -handler [namespace code [list handler testdata]]]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok $testdata]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length $testdata]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain testdata
+ halt_httpd
+} -result {ok {HTTP/1.0 200 OK} ok {} {} {} 0}
+
test http11-4.0 "normal post request" -setup {
variable httpd [create_httpd]
} -body {