diff --git a/src/util.d b/src/util.d index 6db7b0b7..b9515905 100644 --- a/src/util.d +++ b/src/util.d @@ -1,6 +1,7 @@ import std.conv; import std.digest.crc; import std.file; +import std.net.curl; import std.path; import std.regex; import std.socket; @@ -81,13 +82,9 @@ Regex!char wild2regex(const(char)[] pattern) // return true if the network connection is available bool testNetwork() { - try { - auto addr = new InternetAddress("login.live.com", 443); - auto socket = new TcpSocket(addr); - return socket.isAlive(); - } catch (SocketException) { - return false; - } + HTTP http = HTTP("https://login.live.com"); + http.method = HTTP.Method.head; + return http.perform(ThrowOnError.no) == 0; } // call globMatch for each string in pattern separated by '|'