Skip to content
Permalink
Browse files

Fix HTTP Client with SSL (#3216)

  • Loading branch information...
me-no-dev committed Sep 16, 2019
1 parent 0739015 commit 4ce2cc3c1d1e80d5de5d1c43fed69bbf6ee74394
@@ -28,7 +28,15 @@
class WiFiClientSocketHandle;
class WiFiClientRxBuffer;

class WiFiClient : public Client
class ESPLwIPClient : public Client
{
public:
virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
virtual int setTimeout(uint32_t seconds) = 0;
};

class WiFiClient : public ESPLwIPClient
{
protected:
std::shared_ptr<WiFiClientSocketHandle> clientSocketHandle;
@@ -72,6 +72,8 @@ class WiFiClientSecure : public WiFiClient
bool verify(const char* fingerprint, const char* domain_name);
void setHandshakeTimeout(unsigned long handshake_timeout);

int setTimeout(uint32_t seconds){ return 0; }

operator bool()
{
return connected();
@@ -22,20 +22,23 @@

const char *pers = "esp32-tls";

static int handle_error(int err)
static int _handle_error(int err, const char * file, int line)
{
if(err == -30848){
return err;
}
#ifdef MBEDTLS_ERROR_C
char error_buf[100];
mbedtls_strerror(err, error_buf, 100);
log_e("%s", error_buf);
log_e("[%s():%d]: (%d) %s", file, line, err, error_buf);
#else
log_e("[%s():%d]: code %d", file, line, err);
#endif
log_e("MbedTLS message code: %d", err);
return err;
}

#define handle_error(e) _handle_error(e, __FUNCTION__, __LINE__)


void ssl_init(sslclient_context *ssl_client)
{

0 comments on commit 4ce2cc3

Please sign in to comment.
You can’t perform that action at this time.