wininet: Support option INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT for http requests.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
83ca429073
commit
64728c618f
|
@ -2321,6 +2321,19 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
|
|||
|
||||
*(ULONG*)buffer = hdr->ErrorMask;
|
||||
*size = sizeof(ULONG);
|
||||
return ERROR_SUCCESS;
|
||||
case INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT:
|
||||
TRACE("INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT\n");
|
||||
|
||||
if (*size < sizeof(PCCERT_CHAIN_CONTEXT))
|
||||
return ERROR_INSUFFICIENT_BUFFER;
|
||||
|
||||
if (!req->server->cert_chain)
|
||||
return ERROR_INTERNET_INCORRECT_HANDLE_STATE;
|
||||
|
||||
*(PCCERT_CHAIN_CONTEXT *)buffer = CertDuplicateCertificateChain(req->server->cert_chain);
|
||||
*size = sizeof(PCCERT_CHAIN_CONTEXT);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -6855,6 +6855,7 @@ static void test_secure_connection(void)
|
|||
INTERNET_CERTIFICATE_INFOW *certificate_structW = NULL;
|
||||
char certstr1[512], certstr2[512];
|
||||
BOOL ret;
|
||||
PCCERT_CHAIN_CONTEXT chain;
|
||||
|
||||
ses = InternetOpenA("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
|
||||
ok(ses != NULL, "InternetOpen failed\n");
|
||||
|
@ -6886,6 +6887,13 @@ static void test_secure_connection(void)
|
|||
|
||||
test_cert_struct(req, &test_winehq_org_cert);
|
||||
|
||||
size = sizeof(chain);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = InternetQueryOptionA(req, INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT, &chain, &size);
|
||||
ok(ret || GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE /* < IE8 */,
|
||||
"InternetQueryOption failed: %u\n", GetLastError());
|
||||
if (ret) CertFreeCertificateChain(chain);
|
||||
|
||||
/* Querying the same option through InternetQueryOptionW still results in
|
||||
* ANSI strings being returned.
|
||||
*/
|
||||
|
@ -7825,6 +7833,7 @@ static void test_cert_string(void)
|
|||
char actual[512];
|
||||
DWORD size;
|
||||
BOOL res;
|
||||
PCCERT_CHAIN_CONTEXT chain;
|
||||
|
||||
ses = InternetOpenA( "winetest", 0, NULL, NULL, 0 );
|
||||
ok( ses != NULL, "InternetOpenA failed\n" );
|
||||
|
@ -7845,6 +7854,12 @@ static void test_cert_string(void)
|
|||
ok( size == 0, "unexpected size: %u\n", size );
|
||||
ok( actual[0] == 0x55, "unexpected byte: %02x\n", actual[0] );
|
||||
|
||||
size = sizeof(chain);
|
||||
SetLastError(0xdeadbeef);
|
||||
res = InternetQueryOptionA(req, INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT, &chain, &size);
|
||||
ok(!res && (GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_STATE),
|
||||
"InternetQueryOption failed: %u\n", GetLastError());
|
||||
|
||||
InternetCloseHandle( req );
|
||||
InternetCloseHandle( con );
|
||||
InternetCloseHandle( ses );
|
||||
|
|
Loading…
Reference in New Issue