Cloud storage: check connection before connecting

libgit2 takes forever (a minute or so) to figure out that it can't connect
to a remote server.
So if we are using https as connection protocol, quickly check utilizing
RFCs 2324/7168 to make sure we can reach the cloud server (and not some
captive portal or something).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-12 06:31:16 -07:00
parent 5e0c546beb
commit 4d06e8f7b5
4 changed files with 61 additions and 1 deletions

View file

@ -217,6 +217,7 @@ static int check_remote_status(git_repository *repo, git_remote *origin, const c
/* from qthelper.cpp */
extern bool getProxyString(char **proxy_string);
extern bool canReachCloudServer();
static git_repository *update_local_repo(const char *localdir, const char *remote, const char *branch)
{
@ -259,6 +260,8 @@ static git_repository *update_local_repo(const char *localdir, const char *remot
return repo;
}
if (rt == HTTPS && !canReachCloudServer())
return repo;
#if USE_LIBGIT23_API
git_fetch_options opts = GIT_FETCH_OPTIONS_INIT;
if (rt == SSH)