summaryrefslogtreecommitdiffstats
path: root/tests/httpd11.tcl
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/httpd11.tcl
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/httpd11.tcl')
-rw-r--r--tests/httpd11.tcl15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/httpd11.tcl b/tests/httpd11.tcl
index 9c543dc..267f409 100644
--- a/tests/httpd11.tcl
+++ b/tests/httpd11.tcl
@@ -158,13 +158,13 @@ proc Service {chan addr port} {
}
if {$protocol eq "HTTP/1.1"} {
- if {[string match "*deflate*" [dict get? $meta accept-encoding]]} {
- set encoding deflate
- } elseif {[string match "*gzip*" [dict get? $meta accept-encoding]]} {
- set encoding gzip
- } elseif {[string match "*compress*" [dict get? $meta accept-encoding]]} {
- set encoding compress
- }
+ foreach enc [split [dict get? $meta accept-encoding] ,] {
+ set enc [string trim $enc]
+ if {$enc in {deflate gzip compress}} {
+ set encoding $enc
+ break
+ }
+ }
set transfer chunked
} else {
set close 1
@@ -189,6 +189,7 @@ proc Service {chan addr port} {
if {$close} {
Puts $chan "connection: close"
}
+ Puts $chan "x-requested-encodings: [dict get? $meta accept-encoding]"
if {$encoding eq "identity"} {
Puts $chan "content-length: [string length $data]"
} else {