mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 10:18:11 +08:00
Enable TLS host validation in test_http_client()
This commit is contained in:
parent
b78ced4fa9
commit
436852d077
@ -825,8 +825,10 @@ static void test_http_client(void) {
|
|||||||
ok = 0;
|
ok = 0;
|
||||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
||||||
{
|
{
|
||||||
struct mg_tls_opts opts = {.ca = "./test/data/ca.pem"};
|
const char *url = "https://cesanta.com";
|
||||||
c = mg_http_connect(&mgr, "https://cesanta.com", f3, &ok);
|
struct mg_str host = mg_url_host(url);
|
||||||
|
struct mg_tls_opts opts = {.ca = "./test/data/ca.pem", .srvname = host};
|
||||||
|
c = mg_http_connect(&mgr, url, f3, &ok);
|
||||||
ASSERT(c != NULL);
|
ASSERT(c != NULL);
|
||||||
mg_tls_init(c, &opts);
|
mg_tls_init(c, &opts);
|
||||||
for (i = 0; i < 500 && ok <= 0; i++) mg_mgr_poll(&mgr, 10);
|
for (i = 0; i < 500 && ok <= 0; i++) mg_mgr_poll(&mgr, 10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user