Commit 5f2cf732ab8ecbfdf69cad48a52c14483c7aa15f

Carlos Martín Nieto 2014-08-30T13:12:33

winhttp: only do certificate check for SSL If we're not using SSL, don't call the user's certificate check callback.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index 3ddf49d..e6bd1c9 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -212,7 +212,7 @@ static int certificate_check(winhttp_stream *s, int valid)
 	PCERT_CONTEXT cert_ctx;
 	DWORD cert_ctx_size = sizeof(cert_ctx);
 
-	if (t->owner->certificate_check_cb == NULL)
+	if (t->owner->certificate_check_cb == NULL || !t->connection_data.use_ssl)
 		return 0;
 
 	if (!WinHttpQueryOption(s->request, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert_ctx, &cert_ctx_size)) {