Check that we can actually read from network and not just connect
When using Cloudflare, as we do for www.wxwidgets.org, the connection succeeds as long as Cloudflare itself works, but reading later fails if the real server behind Cloudflare proxy does not, so check if we can read something from it.
This commit is contained in:
parent
860dd39fab
commit
239bbd6b82
1 changed files with 5 additions and 1 deletions
|
|
@ -442,9 +442,13 @@ extern bool IsNetworkAvailable()
|
|||
return false;
|
||||
}
|
||||
|
||||
const char* const
|
||||
HTTP_GET = "GET / HTTP /1.1\r\nHost: www.wxwidgets.org\r\n\r\n";
|
||||
|
||||
wxSocketClient sock;
|
||||
sock.SetTimeout(10); // 10 secs
|
||||
bool online = sock.Connect(addr);
|
||||
bool online = sock.Connect(addr) &&
|
||||
(sock.Write(HTTP_GET, strlen(HTTP_GET)), sock.WaitForRead(1));
|
||||
|
||||
wxSocketBase::Shutdown();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue