fix(modem): Fixed OTA test to gracefully fail with no verification

This commit is contained in:
David Cermak
2024-01-17 17:43:47 +01:00
parent ce7daddc77
commit 1dc4299eb0
2 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,10 @@ bool manual_ota::begin()
esp_transport_handle_t tcp = esp_transport_tcp_init();
ssl_ = esp_transport_batch_tls_init(tcp, max_buffer_size_);
http_.config_.transport = ssl_;
if (http_.config_.cert_pem == nullptr || common_name_ == nullptr) {
ESP_LOGE(TAG, "TLS with no verification is not supported");
return fail();
}
if (!esp_transport_batch_set_ca_cert(ssl_, http_.config_.cert_pem, 0)) {
return fail();
}

View File

@ -40,7 +40,7 @@ public:
/**
* @brief Set common name of the server to verify
*/
const char *common_name_;
const char *common_name_{};
/**
* @brief Wrapper around the http client -- Please set the http config
*/