diff options
author | max <max@tclers.tk> | 2017-04-05 14:47:45 (GMT) |
---|---|---|
committer | max <max@tclers.tk> | 2017-04-05 14:47:45 (GMT) |
commit | 55edd253ffe75b5f8d2a8a2501a966f81515659a (patch) | |
tree | 57abcc29f7295ecf5cd79a264ec872474b0813e0 /tests/httpd | |
parent | 19719bf57ffd63ee7e01c539197f59c3e40c3e55 (diff) | |
download | tcl-55edd253ffe75b5f8d2a8a2501a966f81515659a.zip tcl-55edd253ffe75b5f8d2a8a2501a966f81515659a.tar.gz tcl-55edd253ffe75b5f8d2a8a2501a966f81515659a.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/httpd | 7 |
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 |