Skip to content

SSL - A buffer is too small to receive or write a message #7

@SheetLightning

Description

@SheetLightning

I recently used this HTTPSredirect library in one of my projects to access my Google calendar. I have it working on an ESP8266, but wanted to port it to an ESP32 because the project will need the additional GPIO pins. Unfortunately I ran into a problem with Google not returning any events from my calendar. With ESP32 verbose debugging turned on, I was able to capture the following error:

Connected to Google
[ 43293][V][ssl_client.cpp:369] send_ssl_data(): Writing HTTP request with 150 bytes...
[ 43293][V][ssl_client.cpp:374] send_ssl_data(): Handling error -27136
[ 43299][E][ssl_client.cpp:37] _handle_error(): [send_ssl_data():375]: (-27136) SSL - A buffer is too small to receive or write a message
[ 43313][V][ssl_client.cpp:324] stop_ssl_socket(): Cleaning SSL connection.
gclient->GET(url, googleHost);
Performed GET

I am using:

  • Adruino IDE version 1.8.19
  • ESP32 board library version 2.0.4
  • ESP32 development board WROOM-32, Devkit1

The GET request is failing and not returning any data. I presume that the HTTPSredirect library somehow calls the Esspressif ssl_client module but can't see anything in the SDK except a header file. I also can't see any buffer size being set in this library as it uses a String type for the data buffer.

Can I override the size of the SSL buffer please? If so, where?
I have not been able to find anything regarding this on the Expressif Github.

The code is quite straightforward and is based on this project by Andreas Spiess.

https://www.youtube.com/watch?v=sm1-l5-z3ag

I have attached a minimal example.

The error occurs when running the gclient->GET(url, googleHost); statement in my sketch. I have attached a minimal example. See the getCalendar() function.

I should probably point out that I made a minor change to the program to allow it to insert the "ESP32" string in the User-agent line in the GET and POST requests in place of "ESP8266". I don't believe this makes any functional difference, except to indicate to the Google API that the request came from an ESP32 rather than an ESP8266.

Minimal code example:

Google-Minimal.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions