Improve SNI

This commit is contained in:
cpq committed 2021-01-30 13:03:11 +00:00
1 parent 31cf6f8969
commit d327ee9834
8 files changed
+66 -40

No files matched your search

+3
View File
@@ -413,12 +413,15 @@ static int fetch(struct mg_mgr *mgr, char *buf, const char *url,
ASSERT(c != NULL);
if (mg_url_is_ssl(url)) {
struct mg_tls_opts opts;
struct mg_str host = mg_url_host(url);
memset(&opts, 0, sizeof(opts));
opts.ca = "./test/data/ca.pem";
if (strstr(url, "127.0.0.1") != NULL) {
// Local connection, use self-signed certificates
opts.ca = "./test/data/ss_ca.pem";
opts.cert = "./test/data/ss_client.pem";
} else {
opts.srvname = host;
}
mg_tls_init(c, &opts);
// c->is_hexdumping = 1;