summaryrefslogtreecommitdiff
path: root/tests/libgit2
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-03-06 15:19:29 -0800
committerEdward Thomson <ethomson@vercel.com>2023-03-21 09:09:48 +0000
commitf68f542eb63efb0f50e00d2376196f5bd48ed41e (patch)
treeb027843970124cb02cf2f36a7aa663b311fc76cc /tests/libgit2
parent1b929b3d8531dbf6326285491e2e17ff4db2c337 (diff)
downloadlibgit2-f68f542eb63efb0f50e00d2376196f5bd48ed41e.tar.gz
http: introduce schannel streams for windows
Provide a stream interface for Schannel - the native crypto APIs - on Windows. This allows Windows to use the same HTTP transport that all the other platforms use, with its own native crypto. Ultimately this allows us to deprecate WinHTTP and we need not add support for our socket changes in two places (our HTTP stack and the WinHTTP stack).
Diffstat (limited to 'tests/libgit2')
-rw-r--r--tests/libgit2/online/clone.c13
-rw-r--r--tests/libgit2/stream/registration.c6
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/libgit2/online/clone.c b/tests/libgit2/online/clone.c
index 1a4cdb520..b635739b6 100644
--- a/tests/libgit2/online/clone.c
+++ b/tests/libgit2/online/clone.c
@@ -580,6 +580,17 @@ static int succeed_certificate_check(git_cert *cert, int valid, const char *host
return 0;
}
+static int x509_succeed_certificate_check(git_cert *cert, int valid, const char *host, void *payload)
+{
+ GIT_UNUSED(valid);
+ GIT_UNUSED(payload);
+
+ cl_assert_equal_s("github.com", host);
+ cl_assert_equal_i(GIT_CERT_X509, cert->cert_type);
+
+ return 0;
+}
+
static int fail_certificate_check(git_cert *cert, int valid, const char *host, void *payload)
{
GIT_UNUSED(cert);
@@ -901,7 +912,7 @@ void test_online_clone__certificate_invalid(void)
void test_online_clone__certificate_valid(void)
{
- g_options.fetch_opts.callbacks.certificate_check = succeed_certificate_check;
+ g_options.fetch_opts.callbacks.certificate_check = x509_succeed_certificate_check;
cl_git_pass(git_clone(&g_repo, "https://github.com/libgit2/TestGitRepository", "./foo", &g_options));
}
diff --git a/tests/libgit2/stream/registration.c b/tests/libgit2/stream/registration.c
index bf3c20502..ccaecee8c 100644
--- a/tests/libgit2/stream/registration.c
+++ b/tests/libgit2/stream/registration.c
@@ -81,10 +81,10 @@ void test_stream_registration__tls(void)
cl_git_pass(git_stream_register(GIT_STREAM_TLS, NULL));
error = git_tls_stream_new(&stream, "localhost", "443");
- /* We don't have TLS support enabled, or we're on Windows,
- * which has no arbitrary TLS stream support.
+ /* We don't have TLS support enabled, or we're on Windows
+ * with WinHTTP, which is not actually TLS stream support.
*/
-#if defined(GIT_WIN32) || !defined(GIT_HTTPS)
+#if defined(GIT_WINHTTP) || !defined(GIT_HTTPS)
cl_git_fail_with(-1, error);
#else
cl_git_pass(error);