summaryrefslogtreecommitdiffstats
path: root/tests/httpd
diff options
context:
space:
mode:
authormax <max@tclers.tk>2017-04-05 14:47:45 (GMT)
committermax <max@tclers.tk>2017-04-05 14:47:45 (GMT)
commit4f20b26224ed27d2a75607416198e615bee7e128 (patch)
tree57abcc29f7295ecf5cd79a264ec872474b0813e0 /tests/httpd
parent42f3b8e10cbe3342ebc2ca136374b4c5377dc54c (diff)
downloadtcl-4f20b26224ed27d2a75607416198e615bee7e128.zip
tcl-4f20b26224ed27d2a75607416198e615bee7e128.tar.gz
tcl-4f20b26224ed27d2a75607416198e615bee7e128.tar.bz2
Use a random unused port for the dummy http server to avoid conflicts
with local services running on port 8010.
Diffstat (limited to 'tests/httpd')
-rw-r--r--tests/httpd7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/httpd b/tests/httpd
index 40e10df..f15d71b 100644
--- a/tests/httpd
+++ b/tests/httpd
@@ -11,7 +11,12 @@
#set httpLog 1
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