summaryrefslogtreecommitdiffstats
path: root/tests/httpd
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-04-10 09:37:52 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-04-10 09:37:52 (GMT)
commit6626a523f72667a745e0137510e8b65b4984bed0 (patch)
treecb986f83de3ab045e92d999f6b4bf58e10d25b49 /tests/httpd
parent9185b616460eb962ba1546ffb5db0eabd0d68619 (diff)
downloadtcl-6626a523f72667a745e0137510e8b65b4984bed0.zip
tcl-6626a523f72667a745e0137510e8b65b4984bed0.tar.gz
tcl-6626a523f72667a745e0137510e8b65b4984bed0.tar.bz2
Specific check for [Bug 26245326]
This bug is caused by receiving a partial HTTP response line which caused premature switching of the state in the client package before we received the whole line.
Diffstat (limited to 'tests/httpd')
-rw-r--r--tests/httpd16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/httpd b/tests/httpd
index b46a3f0..93ee08a 100644
--- a/tests/httpd
+++ b/tests/httpd
@@ -72,6 +72,10 @@ proc httpdRead { sock } {
# Read the HTTP headers
set readCount [gets $sock line]
+ if {[regexp {^([^:]+):(.*)$} $line -> key val]} {
+ lappend data(meta) $key [string trim $val]
+ }
+
} elseif {$data(state) == "query"} {
# Read the query data
@@ -195,17 +199,25 @@ proc httpdRespond { sock } {
}
# Catch errors from premature client closes
-
+
catch {
if {$data(proto) == "HEAD"} {
puts $sock "HTTP/1.0 200 OK"
} else {
- puts $sock "HTTP/1.0 200 Data follows"
+ # Split the response to test for [Bug 26245326]
+ puts -nonewline $sock "HT"
+ flush $sock
+ puts $sock "TP/1.0 200 Data follows"
}
puts $sock "Date: [clock format [clock seconds] \
-format {%a, %d %b %Y %H:%M:%S %Z}]"
puts $sock "Content-Type: $type"
puts $sock "Content-Length: [string length $html]"
+ foreach {key val} $data(meta) {
+ if {[string match "X-*" $key]} {
+ puts $sock "$key: $val"
+ }
+ }
puts $sock ""
flush $sock
if {$data(proto) != "HEAD"} {