Skip to content

Commit 1bb7764

Browse files
eaferSam Bingner
authored andcommitted
Fix a few issues with the C generator (part 5) (OpenAPITools#20313)
* [C] Default to requiring valid SSL * Update samples --------- Co-authored-by: Sam Bingner <[email protected]>
1 parent 70c24e4 commit 1bb7764

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache

+2-2
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ void apiClient_invoke(apiClient_t *apiClient,
447447
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
448448
}
449449
} else {
450-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
451-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
450+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
451+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
452452
}
453453
}
454454

samples/client/others/c/bearerAuth/src/apiClient.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ void apiClient_invoke(apiClient_t *apiClient,
363363
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
364364
}
365365
} else {
366-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
367-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
366+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
367+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
368368
}
369369
}
370370

samples/client/petstore/c-useJsonUnformatted/src/apiClient.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ void apiClient_invoke(apiClient_t *apiClient,
390390
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
391391
}
392392
} else {
393-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
394-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
393+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
394+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
395395
}
396396
}
397397

samples/client/petstore/c/src/apiClient.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ void apiClient_invoke(apiClient_t *apiClient,
390390
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
391391
}
392392
} else {
393-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
394-
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
393+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
394+
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L);
395395
}
396396
}
397397

0 commit comments

Comments
 (0)