Skip to content

Commit

Permalink
Replace WinHttpRequest with XMLHTTP
Browse files Browse the repository at this point in the history
WinHttpRequest does not use TLS 1.1 or 1.2 by default
on Windows 7 and older.
  • Loading branch information
Lexikos committed Oct 4, 2019
1 parent 9a0b2fd commit 4622287
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions installer/source/Installer_src.ahk
Expand Up @@ -326,12 +326,18 @@ InitUI() {
CheckForUpdates() {
local w := getWindow(), latestVersion := ""
try {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "https://autohotkey.com/download/1.1/version.txt", true)
whr.Send()
whr.WaitForResponse()
latestVersion := whr.responseText
req := ComObjCreate("Msxml2.XMLHTTP")
req.open("GET", "https://autohotkey.com/download/1.1/version.txt?" SubStr(A_Now,1,8), true)
req.onreadystatechange := Func("VersionReceived").Bind(req)
req.send()
}
}

VersionReceived(req) {
local w := getWindow(), latestVersion := ""
if req.readyState != 4
return
latestVersion := req.responseText
if RegExMatch(latestVersion, "^(\d+\.){3}\d+") {
if (latestVersion = ProductVersion)
w.opt1.firstChild.innerText := "Reinstall (download required)"
Expand Down

0 comments on commit 4622287

Please sign in to comment.