esp_http_client: Add support for mutual authentication

Closes https://github.com/espressif/esp-idf/pull/2688
This commit is contained in:
Anders Kalør 2018-11-10 23:51:05 +01:00 committed by Mahavir Jain
parent 07645955a2
commit 8b72dc9fb0
2 changed files with 11 additions and 1 deletions

View file

@ -490,6 +490,14 @@ esp_http_client_handle_t esp_http_client_init(const esp_http_client_config_t *co
if (config->cert_pem) {
esp_transport_ssl_set_cert_data(ssl, config->cert_pem, strlen(config->cert_pem));
}
if (config->client_cert_pem) {
esp_transport_ssl_set_client_cert_data(ssl, config->client_cert_pem, strlen(config->client_cert_pem));
}
if (config->client_key_pem) {
esp_transport_ssl_set_client_key_data(ssl, config->client_key_pem, strlen(config->client_key_pem));
}
#endif
if (_set_config(client, config) != ESP_OK) {

View file

@ -105,7 +105,9 @@ typedef struct {
esp_http_client_auth_type_t auth_type; /*!< Http authentication type, see `esp_http_client_auth_type_t` */
const char *path; /*!< HTTP Path, if not set, default is `/` */
const char *query; /*!< HTTP query */
const char *cert_pem; /*!< SSL Certification, PEM format as string, if the client requires to verify server */
const char *cert_pem; /*!< SSL server certification, PEM format as string, if the client requires to verify server */
const char *client_cert_pem; /*!< SSL client certification, PEM format as string, if the server requires to verify client */
const char *client_key_pem; /*!< SSL client key, PEM format as string, if the server requires to verify client */
esp_http_client_method_t method; /*!< HTTP Method */
int timeout_ms; /*!< Network timeout in milliseconds */
bool disable_auto_redirect; /*!< Disable HTTP automatic redirects */