Skip to content

Commit d7be72e

Browse files
authored
Merge pull request arduino#80 from bcmi-labs/sslclient_fix
SSLClient Add setClient(&client) method
2 parents b848288 + 13184a3 commit d7be72e

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

libraries/SSLClient/examples/TLSCheckWiFi/TLSCheckWiFi.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*
77
**************************************************************/
88

9-
#include "CWifi.h"
10-
#include "CWifiClient.h"
9+
#include "WiFiC3.h"
10+
#include "WiFiClient.h"
1111
#include "SSLClient.h"
1212
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
1313
#include <ArduinoHttpClient.h>

libraries/SSLClient/library.json

-14
This file was deleted.

libraries/SSLClient/src/SSLClient.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ SSLClient::SSLClient()
4040
_private_key = NULL;
4141
_pskIdent = NULL;
4242
_psKey = NULL;
43-
44-
ssl_init(sslclient, nullptr, _CA_path);
45-
46-
sslclient->handshake_timeout = 5000;
4743
}
4844

4945
SSLClient::SSLClient(Client* client)
@@ -92,6 +88,13 @@ SSLClient::~SSLClient()
9288
delete sslclient;
9389
}
9490

91+
void SSLClient::setClient(Client& client)
92+
{
93+
ssl_init(sslclient, &client, _CA_path);
94+
95+
sslclient->handshake_timeout = 5000;
96+
}
97+
9598
void SSLClient::stop()
9699
{
97100
if (sslclient->client >= 0) {

libraries/SSLClient/src/SSLClient.h

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class SSLClient : public Client
4848
SSLClient(Client* client, String ca_path);
4949
~SSLClient();
5050

51+
void setClient(Client& client);
52+
5153
int connect(IPAddress ip, uint16_t port);
5254
int connect(IPAddress ip, uint16_t port, int32_t timeout);
5355
int connect(const char *host, uint16_t port);

libraries/SSLClient/src/ssl_client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
344344
}
345345

346346
if ((rootCABuff != NULL) || ((rootCAPath != NULL))) {
347-
log_e("free buffer");
347+
log_d("free buffer");
348348
mbedtls_x509_crt_free(&ssl_client->ca_cert);
349349
}
350350

0 commit comments

Comments
 (0)