mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 07:28:13 +08:00
Merge branch 'master' of github.com:cesanta/mongoose
This commit is contained in:
commit
5430408218
10
mongoose.c
10
mongoose.c
@ -3593,9 +3593,10 @@ int mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
mbedtls_ssl_conf_ca_chain(&tls->conf, &tls->ca, NULL);
|
||||
#endif
|
||||
if (opts->srvname.len > 0) {
|
||||
char buf[opts->srvname.len + 1];
|
||||
sprintf(buf, "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
char mem[128], *buf = mem;
|
||||
mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
mbedtls_ssl_set_hostname(&tls->ssl, buf);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
mbedtls_ssl_conf_authmode(&tls->conf, MBEDTLS_SSL_VERIFY_REQUIRED);
|
||||
}
|
||||
@ -3768,9 +3769,10 @@ int mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
}
|
||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||
if (opts->srvname.len > 0) {
|
||||
char buf[opts->srvname.len + 1];
|
||||
sprintf(buf, "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
char mem[128], *buf = mem;
|
||||
mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
SSL_set_tlsext_host_name(tls->ssl, buf);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
c->tls = tls;
|
||||
c->is_tls = 1;
|
||||
|
10
src/tls.c
10
src/tls.c
@ -117,9 +117,10 @@ int mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
mbedtls_ssl_conf_ca_chain(&tls->conf, &tls->ca, NULL);
|
||||
#endif
|
||||
if (opts->srvname.len > 0) {
|
||||
char buf[opts->srvname.len + 1];
|
||||
sprintf(buf, "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
char mem[128], *buf = mem;
|
||||
mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
mbedtls_ssl_set_hostname(&tls->ssl, buf);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
mbedtls_ssl_conf_authmode(&tls->conf, MBEDTLS_SSL_VERIFY_REQUIRED);
|
||||
}
|
||||
@ -292,9 +293,10 @@ int mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
}
|
||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||
if (opts->srvname.len > 0) {
|
||||
char buf[opts->srvname.len + 1];
|
||||
sprintf(buf, "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
char mem[128], *buf = mem;
|
||||
mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
SSL_set_tlsext_host_name(tls->ssl, buf);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
c->tls = tls;
|
||||
c->is_tls = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user