Skip to content

Commit 5b08a71

Browse files
authored
Merge pull request libgit2#4934 from stinb/proxy-crash
Fix crash on remote connection when GIT_PROXY_AUTO is set but no proxy is detected
2 parents 99afd41 + 35d86c7 commit 5b08a71

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/transports/http.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ static int load_proxy_config(http_subtransport *t)
679679
!!t->server.url.use_ssl, &t->proxy_url)) < 0)
680680
return error;
681681

682+
if (!t->proxy_url)
683+
return 0;
684+
682685
t->proxy_opts.type = GIT_PROXY_SPECIFIED;
683686
t->proxy_opts.url = t->proxy_url;
684687
t->proxy_opts.credentials = t->owner->proxy.credentials;

tests/online/clone.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,3 +840,10 @@ void test_online_clone__proxy_credentials_in_environment(void)
840840

841841
git_buf_dispose(&url);
842842
}
843+
844+
void test_online_clone__proxy_auto_not_detected(void)
845+
{
846+
g_options.fetch_opts.proxy_opts.type = GIT_PROXY_AUTO;
847+
848+
cl_git_pass(git_clone(&g_repo, "http://github.com/libgit2/TestGitRepository", "./foo", &g_options));
849+
}

0 commit comments

Comments
 (0)