mg_connect_client should set SNI for HTTPS connections

see https://github.com/civetweb/civetweb/issues/1045#issuecomment-997165735
This commit is contained in:
bel2125 2021-12-18 10:03:13 +01:00
parent a06ed2a769
commit a268f2fe07
2 changed files with 5 additions and 2 deletions

View File

@ -37,8 +37,8 @@ main(int argc, char *argv[])
/* Connect client */
char errbuf[256] = {0};
struct mg_client_options opt = {0};
opt.host = argv[1]; /* Host name from command line */
opt.port = 443; /* Default HTTPS port */
opt.host = argv[1]; /* Host name from command line */
opt.port = 443; /* Default HTTPS port */
opt.client_cert = NULL; /* Client certificate, if required */
opt.server_cert = NULL; /* Server certificate to verify */
opt.host_name = opt.host; /* Host name for SNI */

View File

@ -17982,6 +17982,9 @@ mg_connect_client(const char *host,
memset(&opts, 0, sizeof(opts));
opts.host = host;
opts.port = port;
if (use_ssl) {
opts.host_name = host;
}
return mg_connect_client_impl(&opts,
use_ssl,
error_buffer,