diff --git a/mongoose.c b/mongoose.c index 30de4f1610a57cd17e400edb68bab076988c79c1..309d4a55f4628a37537515a3aa5a4dd9fb2e6047 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; }