mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-06 07:16:32 +02:00
SNI support (#592)
Server Name Indication (SNI) support for WiFiClientSecure Fix https://github.com/espressif/arduino-esp32/issues/571 and https://github.com/espressif/arduino-esp32/issues/550
This commit is contained in:
@ -97,7 +97,12 @@ int WiFiClientSecure::connect(const char *host, uint16_t port)
|
||||
|
||||
int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *_CA_cert, const char *_cert, const char *_private_key)
|
||||
{
|
||||
int ret = start_ssl_client(sslclient, ip, port, _CA_cert, _cert, _private_key);
|
||||
return connect(ip.toString().c_str(), port, _CA_cert, _cert, _private_key);
|
||||
}
|
||||
|
||||
int WiFiClientSecure::connect(const char *host, uint16_t port, const char *_CA_cert, const char *_cert, const char *_private_key)
|
||||
{
|
||||
int ret = start_ssl_client(sslclient, host, port, _CA_cert, _cert, _private_key);
|
||||
if (ret < 0) {
|
||||
log_e("lwip_connect_r: %d", errno);
|
||||
stop();
|
||||
@ -107,18 +112,6 @@ int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *_CA_cert,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int WiFiClientSecure::connect(const char *host, uint16_t port, const char *_CA_cert, const char *_cert, const char *_private_key)
|
||||
{
|
||||
struct hostent *server;
|
||||
server = gethostbyname(host);
|
||||
if (server == NULL) {
|
||||
return 0;
|
||||
}
|
||||
IPAddress srv((const uint8_t *)(server->h_addr));
|
||||
return connect(srv, port, _CA_cert, _cert, _private_key);
|
||||
}
|
||||
|
||||
|
||||
size_t WiFiClientSecure::write(uint8_t data)
|
||||
{
|
||||
return write(&data, 1);
|
||||
|
Reference in New Issue
Block a user