Apply 2 useful patches from OpenAPITools/openapi-generator repo:

1. Support SSL client authentication for the c client (#5719)

2. Fix base64 decode funtion (#5642)
This commit is contained in:
Hui Yu
2020-04-01 13:32:02 +08:00
parent a955affd72
commit 62b6012027
2 changed files with 70 additions and 19 deletions

View File

@@ -9,9 +9,17 @@
#include "../include/list.h"
#include "../include/keyValuePair.h"
typedef struct sslConfig_t {
char *clientCertFile; /* client certificate */
char *clientKeyFile; /* client private key */
char *CACertFile; /* CA certificate */
int insecureSkipTlsVerify ; /* 0 -- verify server certificate */
/* 1 -- skip ssl verify for server certificate */
} sslConfig_t;
typedef struct apiClient_t {
char *basePath;
char *caPath;
sslConfig_t *sslConfig;
void *dataReceived;
long response_code;
list_t *apiKeys;
@@ -26,7 +34,7 @@ typedef struct binary_t
apiClient_t* apiClient_create();
apiClient_t* apiClient_create_with_base_path(const char *basePath
, const char *caPath
, sslConfig_t *sslConfig
, list_t *apiKeys
);
@@ -34,10 +42,14 @@ void apiClient_free(apiClient_t *apiClient);
void apiClient_invoke(apiClient_t *apiClient,char* operationParameter, list_t *queryParameters, list_t *headerParameters, list_t *formParameters,list_t *headerType,list_t *contentType, char *bodyParameters, char *requestType);
sslConfig_t *sslConfig_create(const char *clientCertFile, const char *clientKeyFile, const char *CACertFile, int insecureSkipTlsVerify);
void sslConfig_free(sslConfig_t *sslConfig);
char *strReplace(char *orig, char *rep, char *with);
char *base64encode(const void *b64_encode_this, int encode_this_many_bytes);
char *base64decode(const void *b64_decode_this, int decode_this_many_bytes);
char *base64decode(const void *b64_decode_this, int decode_this_many_bytes, int *decoded_bytes);
#endif // INCLUDE_API_CLIENT_H