witnessmenow / Universal-Arduino-Telegram-Bot

Use Telegram on your Arduino (ESP8266 or Wifi-101 boards)
MIT License
1.09k stars 302 forks source link

Changes required for esp32-1.05 library upgrade, line 250 #235

Closed jameszah closed 3 years ago

jameszah commented 3 years ago

Two things:

  1. esp32 now needs the insecure stated, so put this as the last line of setup()

client.setInsecure();

  1. Somebody changed ssl_client or mbedtls_ssl_write, so this line is now bad:

https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/blob/65e6f826cbab242366d69f00cebc25cdd1e81305/src/UniversalTelegramBot.cpp#L250

And needs to be changed to:

client->println();

Its purpose was to send another cr-lf (2 bytes), but what it was actually doing was sending a 0 byte message, then the 2 byte message, but ssl_client.cpp, which calls mbedtls_ssl_write(), declared a fatal error after the 0 byte message.

19:06:57.685 -> *[V][ssl_client.cpp:295] send_ssl_data(): Writing HTTP request with 0 bytes...
19:06:59.279 -> [V][ssl_client.cpp:300] send_ssl_data(): Handling error -80
19:06:59.279 -> [E][ssl_client.cpp:36] _handle_error(): [send_ssl_data():301]: (-80) UNKNOWN ERROR CODE (0050)
19:06:59.279 -> [V][ssl_client.cpp:265] stop_ssl_socket(): Cleaning SSL connection.
19:06:59.314 -> **Start request: --------------------------b8f610217e83e29b

Still haven't learned how to do a PR 😄 Here is some demo code: https://github.com/jameszah/ESP32-Cam-Telegram I'll update my versions of the library from last summer with the fix.