Skip to content

Commit aef13a2

Browse files
authored
HTTPClient - add stubs for SSL-related overloads (#447)
allows using https URLs in code and handle begin() properly, prevents linker from complains
1 parent dccd37e commit aef13a2

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

libraries/HTTPClient/src/HTTPClient.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ bool HTTPClient::begin(WiFiClient &client, String url) {
129129

130130
_port = (protocol == "https" ? 443 : 80);
131131
_secure = (protocol == "https");
132-
return beginInternal(url, protocol.c_str());
132+
if (_secure)
133+
return false;
134+
else
135+
return beginInternal(url, protocol.c_str());
133136
}
134137

135138

@@ -160,7 +163,7 @@ bool HTTPClient::begin(WiFiClient &client, String host, uint16_t port, String ur
160163
_uri = uri;
161164
_protocol = (https ? "https" : "http");
162165
_secure = https;
163-
return true;
166+
return https ? false : true;
164167
}
165168

166169

libraries/HTTPClient/src/HTTPClient.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,13 @@ class HTTPClient
183183

184184
#ifdef HTTPCLIENT_1_1_COMPATIBLE
185185
bool begin(String url);
186-
bool begin(String url, const char* CAcert);
186+
[[deprecated("SSL is not supported in this lib")]]
187+
bool begin(String url, const char* CAcert){ return false; };
187188
bool begin(String host, uint16_t port, String uri = "/");
188-
bool begin(String host, uint16_t port, String uri, const char* CAcert);
189-
bool begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key);
189+
[[deprecated("SSL is not supported in this lib")]]
190+
bool begin(String host, uint16_t port, String uri, const char* CAcert){ return false; };
191+
[[deprecated("SSL is not supported in this lib")]]
192+
bool begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key){ return false; };
190193
#endif
191194

192195
void end(void);

0 commit comments

Comments
 (0)