Tcl Source Code

Artifact [bf2112eadb]
Login

Artifact bf2112eadb96962c7b310aadf13d01c4863532360a8b85383bb183f0bb14d993:

Attachment "fix-test-http-4.14.patch" to ticket [fe57ad096d] added by kjnash 2020-12-14 02:09:24.
diff -Naur original/tests/httpd patched/tests/httpd
--- original/tests/httpd	2020-12-13 15:23:49.601803050 +0000
+++ patched/tests/httpd	2020-12-14 01:35:49.664553999 +0000
@@ -10,12 +10,10 @@
 
 #set httpLog 1
 
-if {$::tcl_platform(os) eq "Darwin"} {
-    # Name resolution often a problem on OSX; not focus of HTTP package anyway
-    set HOST localhost
-} else {
-    set HOST [info hostname]
-}
+# Do not use [info hostname].
+# Name resolution is often a problem on OSX; not focus of HTTP package anyway.
+# Also a problem on other platforms for http-4.14 (test with bad port number).
+set HOST localhost
 
 proc httpd_init {{port 8015}} {
     socket -server httpdAccept $port
diff -Naur original/tests/httpold.test patched/tests/httpold.test
--- original/tests/httpold.test	2020-12-13 15:23:49.602803050 +0000
+++ patched/tests/httpold.test	2020-12-14 01:44:23.060578480 +0000
@@ -33,18 +33,17 @@
     }
 }
 
-if {$::tcl_platform(os) eq "Darwin"} {
-    # Name resolution often a problem on OSX; not focus of HTTP package anyway
-    set HOST localhost
-} else {
-    set HOST [info hostname]
-}
+# Do not use [info hostname].
+# Name resolution is often a problem on OSX; not focus of HTTP package anyway.
+# Also a problem on other platforms for http-4.14 (test with bad port number).
+set HOST localhost
 
 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null"
 catch {unset data}
 
 ##
 ## The httpd script implement a stub http server
+## Sourcing httpd overwrites the value of HOST.
 ##
 source [file join [file dirname [info script]] httpd]
 
diff -Naur original/tests/http.test patched/tests/http.test
--- original/tests/http.test	2020-12-13 15:23:49.600803050 +0000
+++ patched/tests/http.test	2020-12-14 01:42:55.004574281 +0000
@@ -38,13 +38,10 @@
     puts stderr $errorInfo
 }
 
-if {$::tcl_platform(os) eq "Darwin"} {
-    # Name resolution often a problem on OSX; not focus of HTTP package anyway
-    set HOST localhost
-} else {
-    set HOST [info hostname]
-}
-
+# Do not use [info hostname].
+# Name resolution is often a problem on OSX; not focus of HTTP package anyway.
+# Also a problem on other platforms for http-4.14 (test with bad port number).
+set HOST localhost
 set port 8010
 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null"
 catch {unset data}
@@ -81,6 +78,8 @@
 	unset port
 	return
     } else {
+	# Running httpd in the current thread overwrites the values of port
+	# (here) and HOST (in the sourced server file).
 	set port [lindex [fconfigure $listen -sockname] 2]
     }
 }