Skip to content

Commit

Permalink
fix: HTTPS Server API changes for ESP-IDF >= 5.0.2 (hoeken#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhaberler and Michael Haberler committed Aug 7, 2024
1 parent 3aa82f8 commit 91ce801
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/PsychicHttpsServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ esp_err_t PsychicHttpsServer::listen(uint16_t port, const char *cert, const char
this->_use_ssl = true;

this->ssl_config.port_secure = port;
this->ssl_config.cacert_pem = (uint8_t *)cert;
this->ssl_config.cacert_len = strlen(cert)+1;

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 2)
this->ssl_config.servercert = (uint8_t *)cert;
this->ssl_config.servercert_len = strlen(cert)+1;
#else
this->ssl_config.cacert_pem = (uint8_t *)cert;
this->ssl_config.cacert_len = strlen(cert)+1;
#endif

this->ssl_config.prvtkey_pem = (uint8_t *)private_key;
this->ssl_config.prvtkey_len = strlen(private_key)+1;

Expand Down

0 comments on commit 91ce801

Please sign in to comment.