Skip to content

Commit f5674ef

Browse files
manchozRocketct
authored andcommitted
Add support for not sending any SNI
1 parent adcb346 commit f5674ef

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/BearSSLClient.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,25 @@
3131
#include "BearSSLClient.h"
3232

3333
BearSSLClient::BearSSLClient(Client& client) :
34-
BearSSLClient(client, TAs, TAs_NUM)
34+
BearSSLClient(client, TAs, TAs_NUM, false)
35+
{
36+
}
37+
38+
BearSSLClient::BearSSLClient(Client& client, bool noSNI) :
39+
BearSSLClient(client, TAs, TAs_NUM, noSNI)
3540
{
3641
}
3742

3843
BearSSLClient::BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs) :
44+
BearSSLClient(client, TAs, TAs_NUM, false)
45+
{
46+
}
47+
48+
BearSSLClient::BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs, bool noSNI) :
3949
_client(&client),
4050
_TAs(myTAs),
41-
_numTAs(myNumTAs)
51+
_numTAs(myNumTAs),
52+
_noSNI(noSNI)
4253
{
4354
_ecKey.curve = 0;
4455
_ecKey.x = NULL;
@@ -72,7 +83,7 @@ int BearSSLClient::connect(const char* host, uint16_t port)
7283
return 0;
7384
}
7485

75-
return connectSSL(host);
86+
return connectSSL(_noSNI ? NULL : host);
7687
}
7788

7889
size_t BearSSLClient::write(uint8_t b)

src/BearSSLClient.h

+4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class BearSSLClient : public Client {
3838

3939
public:
4040
BearSSLClient(Client& client);
41+
BearSSLClient(Client& client, bool noSNI);
4142
BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs);
43+
BearSSLClient(Client& client, const br_x509_trust_anchor* myTAs, int myNumTAs, bool noSNI);
4244
virtual ~BearSSLClient();
4345

4446
virtual int connect(IPAddress ip, uint16_t port);
@@ -72,6 +74,8 @@ class BearSSLClient : public Client {
7274
const br_x509_trust_anchor* _TAs;
7375
int _numTAs;
7476

77+
bool _noSNI;
78+
7579
br_ec_private_key _ecKey;
7680
br_x509_certificate _ecCert;
7781
bool _ecCertDynamic;

0 commit comments

Comments
 (0)