diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <prabowo@darapsa.org> | 2022-10-05 11:31:52 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <prabowo@darapsa.org> | 2022-10-05 11:31:52 +0800 |
commit | e6fa826426bbe4fead87e63eabbc8b2284455bd8 (patch) | |
tree | d0be120444024061ce8c1950176afd3033d2f5eb | |
parent | 99bd7dc2d2a4e1c35b09c148bd3afb433ef32460 (diff) |
CA info (for cURL) init & clean-up
-rw-r--r-- | midtrans.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -8,16 +8,26 @@ #include <json.h> #include "midtrans.h" +#ifndef __EMSCRIPTEN__ +static char *cainfo = NULL; +#endif + void midtrans_init(const char *certificate) { #ifndef __EMSCRIPTEN__ curl_global_init(CURL_GLOBAL_SSL); + if (certificate) { + cainfo = malloc(strlen(certificate) + 1); + strcpy(cainfo, certificate); + } #endif } void midtrans_cleanup() { #ifndef __EMSCRIPTEN__ + if (cainfo) + free(cainfo); curl_global_cleanup(); #endif } |