summaryrefslogtreecommitdiffstats
path: root/tests/httpd
diff options
context:
space:
mode:
Diffstat (limited to 'tests/httpd')
-rw-r--r--tests/httpd9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/httpd b/tests/httpd
index 16e0382..982f3b8 100644
--- a/tests/httpd
+++ b/tests/httpd
@@ -18,7 +18,12 @@ if {$::tcl_platform(os) eq "Darwin"} {
}
proc httpd_init {{port 8015}} {
- socket -server httpdAccept $port
+ set s [socket -server httpdAccept $port]
+ # Save the actual port number in a global variable.
+ # This is important when we're called with port 0
+ # for picking an unused port at random.
+ set ::port [lindex [chan configure $s -sockname] 2]
+ return $s
}
proc httpd_log {args} {
global httpLog
@@ -216,7 +221,7 @@ proc httpdRespond { sock } {
}
# Catch errors from premature client closes
-
+
catch {
if {$data(proto) == "HEAD"} {
puts $sock "HTTP/1.0 200 OK"