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/http.test | |
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/http.test')
-rw-r--r-- | tests/http.test | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/http.test b/tests/http.test index 12ad475..75c963d 100644 --- a/tests/http.test +++ b/tests/http.test @@ -36,7 +36,6 @@ proc bgerror {args} { puts stderr $errorInfo } -set port 8010 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" catch {unset data} @@ -55,9 +54,8 @@ catch {package require Thread 2.7-} if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { set httpthread [thread::create -preserved] thread::send $httpthread [list source $httpdFile] - thread::send $httpthread [list set port $port] thread::send $httpthread [list set bindata $bindata] - thread::send $httpthread {httpd_init $port} + thread::send $httpthread {httpd_init 0; set port} port puts "Running httpd in thread $httpthread" } else { if {![file exists $httpdFile]} { @@ -69,10 +67,8 @@ if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { # Let the OS pick the port; that's much more flexible if {[catch {httpd_init 0} listen]} { puts "Cannot start http server, http test skipped" - unset port + catch {unset port} return - } else { - set port [lindex [fconfigure $listen -sockname] 2] } } |