summaryrefslogtreecommitdiff
path: root/tests/online/fetch.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-11-19 20:53:25 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2014-11-19 20:57:15 +0100
commit1ca61bdcb9f344f2005eade0e043789774367d29 (patch)
tree8696cfe7e96f08e696f1d2396b2fcbfc7e685bba /tests/online/fetch.c
parent4d86caec599ab760b523a026040bc4f40f8338c9 (diff)
downloadlibgit2-cmn/fetch-twice.tar.gz
fetch: clear the connection data on closecmn/fetch-twice
When we fetch twice with the same remote object, we did not properly clear the connection flags, so we would leak state from the last connection. This can cause the second fetch with the same remote object to fail if using a HTTP URL where the server redirects to HTTPS, as the second fetch would see `use_ssl` set and think the initial connection wanted to downgrade the connection.
Diffstat (limited to 'tests/online/fetch.c')
-rw-r--r--tests/online/fetch.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/online/fetch.c b/tests/online/fetch.c
index ec16dd2fd..848b87410 100644
--- a/tests/online/fetch.c
+++ b/tests/online/fetch.c
@@ -202,3 +202,14 @@ void test_online_fetch__remote_symrefs(void)
git_remote_free(remote);
}
+
+void test_online_fetch__twice(void)
+{
+ git_remote *remote;
+
+ cl_git_pass(git_remote_create(&remote, _repo, "test", "http://github.com/libgit2/TestGitRepository.git"));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
+ cl_git_pass(git_remote_fetch(remote, NULL, NULL, NULL));
+
+ git_remote_free(remote);
+}