From 3892e0199e6ca9613b160535d9d107ede09daa43 Mon Sep 17 00:00:00 2001
From: Sergey Lyubka <valenok@gmail.com>
Date: Thu, 28 Feb 2013 09:12:52 +0000
Subject: [PATCH] Passing user_data to init_ssl()

---
 mongoose.c | 2 +-
 mongoose.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mongoose.c b/mongoose.c
index d5857b050..3e20d1391 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -4705,7 +4705,7 @@ static int set_ssl_option(struct mg_context *ctx) {
   // If user callback returned non-NULL, that means that user callback has
   // set up certificate itself. In this case, skip sertificate setting.
   if ((ctx->callbacks.init_ssl == NULL ||
-       !ctx->callbacks.init_ssl(ctx->ssl_ctx)) &&
+       !ctx->callbacks.init_ssl(ctx->ssl_ctx, ctx->user_data)) &&
       (SSL_CTX_use_certificate_file(ctx->ssl_ctx, pem, 1) == 0 ||
        SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, pem, 1) == 0)) {
     cry(fc(ctx), "%s: cannot open %s: %s", __func__, pem, ssl_error());
diff --git a/mongoose.h b/mongoose.h
index d36353333..84a711bf7 100644
--- a/mongoose.h
+++ b/mongoose.h
@@ -59,7 +59,7 @@ struct mg_callbacks {
   int  (*begin_request)(struct mg_connection *);
   void (*end_request)(const struct mg_connection *, int reply_status_code);
   int  (*log_message)(const struct mg_connection *, const char *message);
-  int  (*init_ssl)(void *ssl_context);
+  int  (*init_ssl)(void *ssl_context, void *user_data);
   int (*websocket_connect)(const struct mg_connection *);
   void (*websocket_ready)(struct mg_connection *);
   int  (*websocket_data)(struct mg_connection *);
-- 
GitLab