diff --git a/mongoose.c b/mongoose.c index e45ce302293ed8a662bee7397c6f631501b20c60..54bee01dedd891349f0a5edf085232e2aa399f26 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4741,8 +4741,10 @@ static int set_ssl_option(struct mg_context *ctx) { int i, size; const char *pem; - // If PEM file is not specified, skip SSL initialization. - if ((pem = ctx->config[SSL_CERTIFICATE]) == NULL) { + // If PEM file is not specified and the init_ssl callback + // is not specified, skip SSL initialization. + if ((pem = ctx->config[SSL_CERTIFICATE]) == NULL && + ctx->callbacks.init_ssl == NULL) { return 1; }