Skip to content

Commit 0abb308

Browse files
authored
rm WifiClientSecure
1 parent 80cb765 commit 0abb308

File tree

1 file changed

+0
-96
lines changed

1 file changed

+0
-96
lines changed

libraries/HTTPClient/src/HTTPClient.cpp

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
#ifdef HTTPCLIENT_1_1_COMPATIBLE
3333
#include <WiFi.h>
34-
#include <WiFiClientSecure.h>
3534
#endif
3635

3736
#include <StreamString.h>
@@ -61,37 +60,6 @@ class TransportTraits
6160
}
6261
};
6362

64-
class TLSTraits : public TransportTraits
65-
{
66-
public:
67-
TLSTraits(const char* CAcert, const char* clicert = nullptr, const char* clikey = nullptr) :
68-
_cacert(CAcert), _clicert(clicert), _clikey(clikey)
69-
{
70-
}
71-
72-
std::unique_ptr<WiFiClient> create() override
73-
{
74-
return std::unique_ptr<WiFiClient>(new WiFiClientSecure());
75-
}
76-
77-
bool verify(WiFiClient& client, const char* host) override
78-
{
79-
WiFiClientSecure& wcs = static_cast<WiFiClientSecure&>(client);
80-
if (_cacert == nullptr) {
81-
wcs.setInsecure();
82-
} else {
83-
wcs.setCACert(_cacert);
84-
wcs.setCertificate(_clicert);
85-
wcs.setPrivateKey(_clikey);
86-
}
87-
return true;
88-
}
89-
90-
protected:
91-
const char* _cacert;
92-
const char* _clicert;
93-
const char* _clikey;
94-
};
9563
#endif // HTTPCLIENT_1_1_COMPATIBLE
9664

9765
/**
@@ -197,29 +165,6 @@ bool HTTPClient::begin(WiFiClient &client, String host, uint16_t port, String ur
197165

198166

199167
#ifdef HTTPCLIENT_1_1_COMPATIBLE
200-
bool HTTPClient::begin(String url, const char* CAcert)
201-
{
202-
if(_client && !_tcpDeprecated) {
203-
log_d("mix up of new and deprecated api");
204-
_canReuse = false;
205-
end();
206-
}
207-
208-
clear();
209-
_port = 443;
210-
if (!beginInternal(url, "https")) {
211-
return false;
212-
}
213-
_secure = true;
214-
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert));
215-
if(!_transportTraits) {
216-
log_e("could not create transport traits");
217-
return false;
218-
}
219-
220-
return true;
221-
}
222-
223168
/**
224169
* parsing the url for all needed parameters
225170
* @param url String
@@ -322,47 +267,6 @@ bool HTTPClient::begin(String host, uint16_t port, String uri)
322267
return true;
323268
}
324269

325-
bool HTTPClient::begin(String host, uint16_t port, String uri, const char* CAcert)
326-
{
327-
if(_client && !_tcpDeprecated) {
328-
log_d("mix up of new and deprecated api");
329-
_canReuse = false;
330-
end();
331-
}
332-
333-
clear();
334-
_host = host;
335-
_port = port;
336-
_uri = uri;
337-
338-
if (strlen(CAcert) == 0) {
339-
return false;
340-
}
341-
_secure = true;
342-
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert));
343-
return true;
344-
}
345-
346-
bool HTTPClient::begin(String host, uint16_t port, String uri, const char* CAcert, const char* cli_cert, const char* cli_key)
347-
{
348-
if(_client && !_tcpDeprecated) {
349-
log_d("mix up of new and deprecated api");
350-
_canReuse = false;
351-
end();
352-
}
353-
354-
clear();
355-
_host = host;
356-
_port = port;
357-
_uri = uri;
358-
359-
if (strlen(CAcert) == 0) {
360-
return false;
361-
}
362-
_secure = true;
363-
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert, cli_cert, cli_key));
364-
return true;
365-
}
366270
#endif // HTTPCLIENT_1_1_COMPATIBLE
367271

368272
/**

0 commit comments

Comments
 (0)