summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-02-05 12:09:08 (GMT)
committerhobbs <hobbs>2000-02-05 12:09:08 (GMT)
commit1def23b8af3c12be20454ea373468d30e8d4a6c3 (patch)
treeffc9c01ae08e516198337d6c059e8f811a550d3d
parent924d9e0129d20eda785f4f2aa7161d9bf6264b12 (diff)
downloadtcl-1def23b8af3c12be20454ea373468d30e8d4a6c3.zip
tcl-1def23b8af3c12be20454ea373468d30e8d4a6c3.tar.gz
tcl-1def23b8af3c12be20454ea373468d30e8d4a6c3.tar.bz2
* tests/httpd: improved query support in test httpd to handle fix
in http.tcl. [Bug: 4089 change 2000-02-01]
-rw-r--r--tests/httpd18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/httpd b/tests/httpd
index 1531964..ddfa6bf 100644
--- a/tests/httpd
+++ b/tests/httpd
@@ -58,6 +58,12 @@ proc httpdRead { sock } {
}
return
}
+ # Extra check to handle -1,query,POST case, where we may see eof,
+ # although the data is there, just without a final newline. A proper
+ # server would handle this better.
+ if {[regexp {Content-Length: (\d+)} $line match length]} {
+ set data(length) $length
+ }
# string compare $readCount 0 maps -1 to -1, 0 to 0, and > 0 to 1
@@ -77,10 +83,20 @@ proc httpdRead { sock } {
1,mime,HEAD -
1,mime,POST -
1,mime,GET {
- if [regexp {([^:]+):[ ]*(.*)} $line dummy key value] {
+ if {[regexp {([^:]+):[ ]*(.*)} $line dummy key value]} {
set data(mime,[string tolower $key]) $value
}
}
+ -1,query,POST {
+ if {[info exists data(length)]} {
+ append data(query) [read $sock $data(length)]
+ httpdRespond $sock
+ return
+ }
+ httpd_log $sock Error "unexpected eof on <$data(url)> request"
+ httpdError $sock 404
+ httpdSockDone $sock
+ }
1,query,POST {
append data(query) $line
httpdRespond $sock