summaryrefslogtreecommitdiffstats
path: root/tests/http11.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-05-14 08:05:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-05-14 08:05:37 (GMT)
commite333cabdeec6802bacdab621d6567618954581e6 (patch)
tree535da7010f103cd3f7fe9a248b89e8d749c0657f /tests/http11.test
parent76caae45f6017bfb0bb12a45f978e3d24b0dcfa5 (diff)
downloadtcl-e333cabdeec6802bacdab621d6567618954581e6.zip
tcl-e333cabdeec6802bacdab621d6567618954581e6.tar.gz
tcl-e333cabdeec6802bacdab621d6567618954581e6.tar.bz2
[b9d0434667] Prefer the gzip encoding for transfers. It's less efficient, but
it is far more interoperable and that's a more important metric.
Diffstat (limited to 'tests/http11.test')
-rw-r--r--tests/http11.test33
1 files changed, 26 insertions, 7 deletions
diff --git a/tests/http11.test b/tests/http11.test
index 230ce5a..c9ded0b 100644
--- a/tests/http11.test
+++ b/tests/http11.test
@@ -70,11 +70,8 @@ proc check_crc {tok args} {
return "ok"
}
-makeFile "<html><head><title>test</title></head>\
-<body><p>this is a test</p>\n\
-[string repeat {<p>This is a tcl test file.</p>} 4192]\n\
-</body></html>" testdoc.html
-
+makeFile "<html><head><title>test</title></head><body><p>this is a test</p>\n[string repeat {<p>This is a tcl test file.</p>} 4192]\n</body></html>" testdoc.html
+
# -------------------------------------------------------------------------
test http11-1.0 "normal request for document " -setup {
@@ -447,7 +444,8 @@ test http11-2.10 "-channel,deflate,keepalive" -setup {
set chan [open [makeFile {} testfile.tmp] wb+]
} -body {
set tok [http::geturl http://localhost:$httpd_port/testdoc.html \
- -timeout 5000 -channel $chan -keepalive 1]
+ -timeout 5000 -channel $chan -keepalive 1 \
+ -headers {accept-encoding deflate}]
http::wait $tok
seek $chan 0
set data [read $chan]
@@ -482,6 +480,27 @@ test http11-2.11 "-channel,identity,keepalive" -setup {
halt_httpd
} -result {ok {HTTP/1.1 200 OK} ok {} {} chunked}
+test http11-2.12 "-channel,negotiate,keepalive" -setup {
+ variable httpd [create_httpd]
+ set chan [open [makeFile {} testfile.tmp] wb+]
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html \
+ -timeout 5000 -channel $chan -keepalive 1]
+ http::wait $tok
+ seek $chan 0
+ set data [read $chan]
+ list [http::status $tok] [http::code $tok] [check_crc $tok $data]\
+ [meta $tok connection] [meta $tok content-encoding]\
+ [meta $tok transfer-encoding] [meta $tok x-requested-encodings]\
+ [expr {[file size testdoc.html]-[file size testfile.tmp]}]
+} -cleanup {
+ http::cleanup $tok
+ close $chan
+ removeFile testfile.tmp
+ halt_httpd
+} -result {ok {HTTP/1.1 200 OK} ok {} gzip chunked gzip,deflate,compress 0}
+
+
# -------------------------------------------------------------------------
#
# The following tests for the -handler option will require changes in
@@ -644,7 +663,7 @@ test http11-4.3 "normal post request, check channel query length" -setup {
removeFile testfile.tmp
halt_httpd
} -result {status ok code {HTTP/1.1 200 OK} crc ok connection close query-length 122880}
-
+
# -------------------------------------------------------------------------
foreach p {create_httpd httpd_read halt_httpd meta check_crc} {