//tls 启用 TLS import sys.reg; namespace inet.tls{ if( _WIN7_LATER){ var path = "Software\Microsoft\Windows\CurrentVersion\Internet Settings" if(!_WIN10_LATER){ ..sys.reg.setValue("SecureProtocols",0xA80,path); } else { var secureProtocols = ..sys.reg.getValue("SecureProtocols",path); if(secureProtocols && secureProtocols<0x800/*TLS 1.2 */){ ..sys.reg.setValue("SecureProtocols",0x2000 | 0x800); } } } } /**details(说明) 注册表键: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings 下面是 SecureProtocols 可能的值(多个值通过按位或组合): - 8 SSL 2.0 - 0x20 SSL 3.0 - 0x80 TLS 1.0 - 0x200 TLS 1.1 - 0x800 TLS 1.2 - 0x2000 TLS 1.3 (Win11) 实际上现在所有网站的最低要求是 TLS 1.2 。 Win10,Win11 不用改。 新版 Win10,Win11 默认值为 0x2000 | 0x800 老版 Win10 默认值为 0x800 有些软件错误地修改了 Win10,Win11 这个注册表值, 会导致 inet.http 返回 12157 错误。 inet.tls 在 Win7 会将此值修改为 0xA80, 而在 Win10 以后的系统只有在检测到 SecureProtocols 低于 TLS 1.2 这样的错误值才会进行修正。 end details**/ /**intellisense() inet.tls = 在 WIN7 系统上为 inet.http 以及 web.form 启用 TLS 1.2。\n在 Win10 以后系统只有在检测到注册表被错误地修改为低于 TLS 1.2 时才会进行修正。\ninet.http,web.form,以及所有 web.rest 的客户端都已默认导入此库 end intellisense**/