Tcl Source Code

Artifact [d8f74d54f5]
Login

Artifact d8f74d54f57f0a5d1424208accc2f8e80b997ddc:

Attachment "http-patch-for-71e6ac46c0.patch" to ticket [bc432269b7] added by kjnash 2017-04-14 19:08:12. (unpublished)
diff -Naur original/library/http/http.tcl patched/library/http/http.tcl
--- original/library/http/http.tcl	2017-04-14 19:47:18.461369180 +0100
+++ patched/library/http/http.tcl	2017-04-14 19:52:42.507790472 +0100
@@ -28,10 +28,19 @@
 	# We need a useragent string of this style or various servers will refuse to
 	# send us compressed content even when we ask for it. This follows the
 	# de-facto layout of user-agent strings in current browsers.
-	set http(-useragent) "Mozilla/5.0\
-            ([string totitle $::tcl_platform(platform)]; U;\
-            $::tcl_platform(os) $::tcl_platform(osVersion))\
-            http/[package provide http] Tcl/[package provide Tcl]"
+	# Safe interpreters do not have ::tcl_platform(os) or
+	# ::tcl_platform(osVersion).
+	if {[interp issafe]} {
+	    set http(-useragent) "Mozilla/5.0\
+                (Windows; U;\
+                Windows NT 10.0)\
+                http/[package provide http] Tcl/[package provide Tcl]"
+	} else {
+	    set http(-useragent) "Mozilla/5.0\
+                ([string totitle $::tcl_platform(platform)]; U;\
+                $::tcl_platform(os) $::tcl_platform(osVersion))\
+                http/[package provide http] Tcl/[package provide Tcl]"
+	}
     }
 
     proc init {} {