diff options
-rw-r--r-- | changes | 2 | ||||
-rw-r--r-- | library/http/http.tcl | 17 |
2 files changed, 15 insertions, 4 deletions
@@ -8761,4 +8761,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres) +2017-04-18 (bug)[bc4322] http package support for safe interps (nash,nijtmans) + --- Released 8.6.7, April 30, 2016 --- http://core.tcl.tk/tcl/ for details diff --git a/library/http/http.tcl b/library/http/http.tcl index ccd4cd1..03751a3 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -28,10 +28,19 @@ namespace eval http { # 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 {} { |