summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2014-08-27 10:28:46 +0200
committernulltoken <emeric.fermas@gmail.com>2014-08-27 10:28:46 +0200
commite75a9ee45fa8cd8311151730dcbdf3befab2bd16 (patch)
treea612e7cef703e95f65cbb3b023dceb4b686083cf
parentcb92467bc284b87c38cdf32f8803a528846d094b (diff)
downloadlibgit2-ntk/propagate_url_parsing_error.tar.gz
winhttp: Prevent swallowing of url parsing errorntk/propagate_url_parsing_error
-rw-r--r--src/transports/winhttp.c6
-rw-r--r--tests/online/clone.c5
2 files changed, 8 insertions, 3 deletions
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index 1e46dfaee..836c488cc 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -1116,9 +1116,9 @@ static int winhttp_action(
int ret = -1;
if (!t->connection)
- if (gitno_connection_data_from_url(&t->connection_data, url, NULL) < 0 ||
- winhttp_connect(t, url) < 0)
- return -1;
+ if ((ret = gitno_connection_data_from_url(&t->connection_data, url, NULL)) < 0 ||
+ (ret = winhttp_connect(t, url)) < 0)
+ return ret;
if (winhttp_stream_alloc(t, &s) < 0)
return -1;
diff --git a/tests/online/clone.c b/tests/online/clone.c
index 0cd0f3115..be90bb4b9 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -381,3 +381,8 @@ void test_online_clone__ssh_with_paths(void)
cl_git_pass(git_clone(&g_repo, remote_url, "./foo", &g_options));
}
+void test_online_clone__url_with_no_path_returns_EINVALIDSPEC(void)
+{
+ cl_git_fail_with(git_clone(&g_repo, "http://github.com", "./foo", &g_options),
+ GIT_EINVALIDSPEC);
+}