@@ -13,6 +13,7 @@ apiClient_t *apiClient_create() {
1313 curl_global_init(CURL_GLOBAL_ALL);
1414 apiClient_t *apiClient = malloc(sizeof(apiClient_t));
1515 apiClient-> basePath = strdup(" {{{basePath}}}" );
16+ apiClient-> caPath = NULL;
1617 apiClient-> dataReceived = NULL;
1718 apiClient-> response_code = 0;
1819 {{#hasAuthMethods} }
@@ -34,6 +35,7 @@ apiClient_t *apiClient_create() {
3435}
3536
3637apiClient_t *apiClient_create_with_base_path(const char *basePath
38+ , const char *caPath
3739{ {#hasAuthMethods} }
3840{ {#authMethods} }
3941{ {#isApiKey} }
@@ -49,6 +51,13 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath
4951 } else{
5052 apiClient-> basePath = strdup(" {{{basePath}}}" );
5153 }
54+
55+ if(caPath){
56+ apiClient-> caPath = strdup(caPath);
57+ } else{
58+ apiClient-> caPath = NULL;
59+ }
60+
5261 apiClient->dataReceived = NULL;
5362 apiClient->response_code = 0;
5463 { {#hasAuthMethods} }
@@ -83,6 +92,9 @@ void apiClient_free(apiClient_t *apiClient) {
8392 if (apiClient-> basePath ) {
8493 free(apiClient-> basePath );
8594 }
95+ if(apiClient->caPath) {
96+ free(apiClient-> caPath );
97+ }
8698 { {#hasAuthMethods} }
8799 { {#authMethods} }
88100 { {#isBasic} }
@@ -375,6 +387,17 @@ void apiClient_invoke(apiClient_t *apiClient,
375387 free(headerValueToWrite);
376388 }
377389 }
390+
391+ if( strstr(apiClient->basePath, "https") != NULL ){
392+ if (apiClient-> caPath ) {
393+ curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, true );
394+ curl_easy_setopt(handle, CURLOPT_CAINFO, apiClient-> caPath );
395+ } else {
396+ curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, false );
397+ curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, false );
398+ }
399+ }
400+
378401 { {#hasAuthMethods} }
379402 { {#authMethods} }
380403 { {#isApiKey} }
0 commit comments