Skip to content

Commit 6cc2a32

Browse files
committed
feat: Insecure skips setting certificate
1 parent 6b73798 commit 6cc2a32

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/InfluxDbClient.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,21 @@ bool InfluxDBClient::init() {
131131
if(https) {
132132
#if defined(ESP8266)
133133
BearSSL::WiFiClientSecure *wifiClientSec = new BearSSL::WiFiClientSecure;
134-
if(_certInfo && strlen_P(_certInfo) > 0) {
134+
if (_insecure) {
135+
wifiClientSec->setInsecure();
136+
} else if(_certInfo && strlen_P(_certInfo) > 0) {
135137
if(strlen_P(_certInfo) > 60 ) { //differentiate fingerprint and cert
136138
_cert = new BearSSL::X509List(_certInfo);
137139
wifiClientSec->setTrustAnchors(_cert);
138140
} else {
139141
wifiClientSec->setFingerprint(_certInfo);
140142
}
141143
}
142-
if (_insecure) {
143-
wifiClientSec->setInsecure();
144-
}
144+
145145
checkMFLN(wifiClientSec, _serverUrl);
146146
#elif defined(ESP32)
147147
WiFiClientSecure *wifiClientSec = new WiFiClientSecure;
148-
if(_certInfo && strlen_P(_certInfo) > 0) {
148+
if(!_insecure && _certInfo && strlen_P(_certInfo) > 0) {
149149
wifiClientSec->setCACert(_certInfo);
150150
}
151151
#endif

0 commit comments

Comments
 (0)