Skip to content

Commit

Permalink
Added String hostname support to WiFiClient and WiFiClientSecure (esp…
Browse files Browse the repository at this point in the history
…8266#3349)

* Added String hostname support to WiFiClient and WiFiClientSecure

* Typo in WiFi
  • Loading branch information
Mindavi authored and devyte committed Dec 29, 2017
1 parent 0b2df35 commit 2880354
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ int WiFiClient::connect(const char* host, uint16_t port)
return 0;
}

int WiFiClient::connect(const String host, uint16_t port)
{
return connect(host.c_str(), port);
}

int WiFiClient::connect(IPAddress ip, uint16_t port)
{
ip_addr_t addr;
Expand Down
1 change: 1 addition & 0 deletions libraries/ESP8266WiFi/src/WiFiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class WiFiClient : public Client, public SList<WiFiClient> {
uint8_t status();
virtual int connect(IPAddress ip, uint16_t port);
virtual int connect(const char *host, uint16_t port);
virtual int connect(const String host, uint16_t port);
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
size_t write_P(PGM_P buf, size_t size);
Expand Down
5 changes: 5 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ int WiFiClientSecure::connect(const char* name, uint16_t port)
return _connectSSL(name);
}

int WiFiClientSecure::connect(const String host, uint16_t port)
{
return connect(host.c_str(), port);
}

int WiFiClientSecure::_connectSSL(const char* hostName)
{
if (!_ssl) {
Expand Down
1 change: 1 addition & 0 deletions libraries/ESP8266WiFi/src/WiFiClientSecure.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class WiFiClientSecure : public WiFiClient {
WiFiClientSecure& operator=(const WiFiClientSecure&);

int connect(IPAddress ip, uint16_t port) override;
int connect(const String host, uint16_t port) override;
int connect(const char* name, uint16_t port) override;

bool verify(const char* fingerprint, const char* domain_name);
Expand Down

0 comments on commit 2880354

Please sign in to comment.