diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-18 19:01:51 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-18 19:01:51 (GMT) |
commit | b81e3f31107806afa1ded9182c90c6f0270668ae (patch) | |
tree | a0446b76d3da765b1827a28cce09e73b8fb15b62 /library/http/http.tcl | |
parent | 40341909aa76ca7004a6adf375c325b23684c897 (diff) | |
download | tcl-b81e3f31107806afa1ded9182c90c6f0270668ae.zip tcl-b81e3f31107806afa1ded9182c90c6f0270668ae.tar.gz tcl-b81e3f31107806afa1ded9182c90c6f0270668ae.tar.bz2 |
Fix [bc432269b74e9b246bf01f354714fed47cb227ed|bc432269]: http fails in a safe interpreter
Diffstat (limited to 'library/http/http.tcl')
-rw-r--r-- | library/http/http.tcl | 17 |
1 files changed, 13 insertions, 4 deletions
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 {} { |