[core] Update verbose messages in MbedTLSClient
This commit is contained in:
@@ -38,6 +38,7 @@ void MbedTLSClient::stop() {
|
|||||||
}
|
}
|
||||||
mbedtls_ssl_free(&_sslCtx);
|
mbedtls_ssl_free(&_sslCtx);
|
||||||
mbedtls_ssl_config_free(&_sslCfg);
|
mbedtls_ssl_config_free(&_sslCfg);
|
||||||
|
LT_HEAP_I();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MbedTLSClient::init() {
|
void MbedTLSClient::init() {
|
||||||
@@ -83,7 +84,11 @@ static int ssl_random(void *data, unsigned char *output, size_t len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void debug_cb(void *ctx, int level, const char *file, int line, const char *str) {
|
void debug_cb(void *ctx, int level, const char *file, int line, const char *str) {
|
||||||
LT_I("%04d: |%d| %s", line, level, str);
|
// do not print the trailing \n
|
||||||
|
uint16_t len = strlen(str);
|
||||||
|
char *msg = (char *)str;
|
||||||
|
msg[len - 1] = '\0';
|
||||||
|
LT_I("%04d: |%d| %s", line, level, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MbedTLSClient::connect(
|
int MbedTLSClient::connect(
|
||||||
@@ -96,7 +101,7 @@ int MbedTLSClient::connect(
|
|||||||
const char *pskIdent,
|
const char *pskIdent,
|
||||||
const char *psk
|
const char *psk
|
||||||
) {
|
) {
|
||||||
LT_D_SSL("Free heap before TLS: TODO");
|
LT_HEAP_I();
|
||||||
|
|
||||||
if (!rootCABuf && !pskIdent && !psk && !_insecure && !_useRootCA)
|
if (!rootCABuf && !pskIdent && !psk && !_insecure && !_useRootCA)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -118,6 +123,7 @@ int MbedTLSClient::connect(
|
|||||||
|
|
||||||
LT_V_SSL("Init SSL");
|
LT_V_SSL("Init SSL");
|
||||||
init();
|
init();
|
||||||
|
LT_HEAP_I();
|
||||||
|
|
||||||
// mbedtls_debug_set_threshold(4);
|
// mbedtls_debug_set_threshold(4);
|
||||||
// mbedtls_ssl_conf_dbg(&_sslCfg, debug_cb, NULL);
|
// mbedtls_ssl_conf_dbg(&_sslCfg, debug_cb, NULL);
|
||||||
@@ -206,6 +212,8 @@ int MbedTLSClient::connect(
|
|||||||
mbedtls_ssl_set_bio(&_sslCtx, &_sockTls, mbedtls_net_send, mbedtls_net_recv, NULL);
|
mbedtls_ssl_set_bio(&_sslCtx, &_sockTls, mbedtls_net_send, mbedtls_net_recv, NULL);
|
||||||
mbedtls_net_set_nonblock((mbedtls_net_context *)&_sockTls);
|
mbedtls_net_set_nonblock((mbedtls_net_context *)&_sockTls);
|
||||||
|
|
||||||
|
LT_HEAP_I();
|
||||||
|
|
||||||
LT_V_SSL("SSL handshake");
|
LT_V_SSL("SSL handshake");
|
||||||
if (_handshakeTimeout == 0)
|
if (_handshakeTimeout == 0)
|
||||||
_handshakeTimeout = timeout;
|
_handshakeTimeout = timeout;
|
||||||
@@ -221,6 +229,8 @@ int MbedTLSClient::connect(
|
|||||||
delay(2);
|
delay(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LT_HEAP_I();
|
||||||
|
|
||||||
if (clientCert && clientKey) {
|
if (clientCert && clientKey) {
|
||||||
LT_D_SSL(
|
LT_D_SSL(
|
||||||
"Protocol %s, ciphersuite %s",
|
"Protocol %s, ciphersuite %s",
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ WebServer::WebServer(IPAddress addr, int port)
|
|||||||
_statusChange(0), _nullDelay(true), _currentHandler(nullptr), _firstHandler(nullptr), _lastHandler(nullptr),
|
_statusChange(0), _nullDelay(true), _currentHandler(nullptr), _firstHandler(nullptr), _lastHandler(nullptr),
|
||||||
_currentArgCount(0), _currentArgs(nullptr), _postArgsLen(0), _postArgs(nullptr), _headerKeysCount(0),
|
_currentArgCount(0), _currentArgs(nullptr), _postArgsLen(0), _postArgs(nullptr), _headerKeysCount(0),
|
||||||
_currentHeaders(nullptr), _contentLength(0), _chunked(false) {
|
_currentHeaders(nullptr), _contentLength(0), _chunked(false) {
|
||||||
log_v("WebServer::Webserver(addr=%s, port=%d)", addr.toString().c_str(), port);
|
log_v("WebServer::Webserver(addr=%s, port=%d)", ipToString(addr).c_str(), port);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebServer::WebServer(int port)
|
WebServer::WebServer(int port)
|
||||||
@@ -265,7 +265,7 @@ void WebServer::handleClient() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_v("New client: client.localIP()=%s", client.localIP().toString().c_str());
|
log_v("New client: client.localIP()=%s", ipToString(client.localIP()).c_str());
|
||||||
|
|
||||||
_currentClient = client;
|
_currentClient = client;
|
||||||
_currentStatus = HC_WAIT_READ;
|
_currentStatus = HC_WAIT_READ;
|
||||||
|
|||||||
Reference in New Issue
Block a user