Skip to content

Commit 0705aa1

Browse files
authored
Merge pull request #988 from pennam/se050-sni-fix
WiFiSSLSE050Client: fix sni setting 2nd part
2 parents 11c3c83 + 148b74c commit 0705aa1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Diff for: libraries/SE05X/src/WiFiSSLSE050Client.h

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class MbedSSLSE050Client : public arduino::MbedSSLClient {
4848
return 0;
4949
}
5050

51+
if(_hostname && !_disableSNI) {
52+
((TLSSocket*)sock)->set_hostname(_hostname);
53+
}
54+
5155
if( NSAPI_ERROR_OK != ((TLSSocket*)sock)->append_root_ca_cert(_ca_cert_custom)) {
5256
return 0;
5357
}

Diff for: libraries/SocketWrapper/src/MbedSSLClient.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "MbedSSLClient.h"
22

3-
arduino::MbedSSLClient::MbedSSLClient(): _disableSNI{false} {
3+
arduino::MbedSSLClient::MbedSSLClient()
4+
: _ca_cert_custom(nullptr),
5+
_hostname(nullptr),
6+
_disableSNI(false) {
7+
48
onBeforeConnect(mbed::callback(this, &MbedSSLClient::setRootCA));
59
};

Diff for: libraries/SocketWrapper/src/MbedSSLClient.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class MbedSSLClient : public arduino::MbedClient {
5353
}
5454

5555
protected:
56-
const char* _ca_cert_custom = NULL;
57-
const char* _hostname = NULL;
56+
const char* _ca_cert_custom;
57+
const char* _hostname;
58+
bool _disableSNI;
5859

5960
private:
6061
int setRootCA() {
@@ -90,8 +91,6 @@ class MbedSSLClient : public arduino::MbedClient {
9091
}
9192
return err;
9293
}
93-
94-
bool _disableSNI;
9594
};
9695

9796
}

0 commit comments

Comments
 (0)