Get rid of mg_*asprintf

This commit is contained in:
cpq committed 2022-08-13 15:37:55 +01:00
1 parent ccf5364187
commit d76f86f7db
13 files changed
+88 -244

No files matched your search

+3 -14
View File
@@ -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;