mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-02 13:20:51 +00:00
Get rid of mg_*asprintf
This commit is contained in:
1 parent
ccf5364187
commit
d76f86f7db
13 files changed
+88
-244
No files matched your search
+3
-14
@@ -89,22 +89,11 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if OPENSSL_VERSION_NUMBER > 0x10002000L
|
||||
if (opts->srvname.len > 0) {
|
||||
char mem[128], *buf = mem;
|
||||
mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
|
||||
opts->srvname.ptr);
|
||||
SSL_set1_host(tls->ssl, buf);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
#endif
|
||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||
if (opts->srvname.len > 0) {
|
||||
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);
|
||||
char *s = mg_mprintf("%.*s", (int) opts->srvname.len, opts->srvname.ptr);
|
||||
SSL_set1_host(tls->ssl, s);
|
||||
free(s);
|
||||
}
|
||||
c->tls = tls;
|
||||
c->is_tls = 1;
|
||||
|
||||
Reference in new issue
Block a user