From 1def23b8af3c12be20454ea373468d30e8d4a6c3 Mon Sep 17 00:00:00 2001 From: hobbs Date: Sat, 5 Feb 2000 12:09:08 +0000 Subject: * tests/httpd: improved query support in test httpd to handle fix in http.tcl. [Bug: 4089 change 2000-02-01] --- tests/httpd | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 -- cgit v0.12