Code Monkey home page Code Monkey logo

httpsredirect's Issues

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

I recently used this HTTPSredirect library in one of my projects to access my Google calendar. I have it working on an ESP8266, but want to port it to an ESP32 because the project will need the extra GPIO pins. Unfortunately I ran into this (captured with ESP32 debug mode set to verbose):

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

The GET request then fails to return any data. I presume that this library somehow calls the Esspressif ssl_client module but can't see how? The GET method in this library seems to only create the GET request in an appropriate format? I also can't see any buffer size being set in this library as it uses a String type for the data buffer. So where do I set the size of the SSL buffer please?

The code is quite straightforward and based on a project by Andreas Spiess. I have attached a minimal example.

The error occurs when running the gclient->GET(url, googleHost); statement.

Google-Minimal.zip

example.

HELLO.
Can you provide an example code for Google calendar?
Thanks.
Marc.

my nodemcu code is hanging

im using nodemcu and im try to connect my esp8266 to google sheet to
read and write to the sheet.
im using arduino ota to update my code.
the software is working fine for only one day and half for maximum
period of time and then my nodemcu hang and no serial data printed or
code execution except the arduino ota.
i have this issue one month ago i need your help please.

Debug Macro Not working

//I wrote simple program to test debug macros, but it gives me compilation error

//Program:
#include <Arduino.h>

#define DEBUG

#ifdef DEBUG
#define DPRINT(...) Serial.print(VA_ARGS)
#define DPRINTLN(...) Serial.println(VA_ARGS)
#else
// define blank line
#define DPRINT(...)
#define DPRINTLN(...)
#endif

void setup() {
// put your setup code here, to run once:
String str ="Hello MrNams";
DPRINT("Here is my string %s",str);
}

void loop() {
// put your main code here, to run repeatedly:
}

//Compilation Error:
src/main.cpp: In function 'void setup()':
src/main.cpp:7:50: error: no matching function for call to 'HardwareSerial::print(const char [21], String&)'
#define DPRINT(...) Serial.print(VA_ARGS)
^
src/main.cpp:19:3: note: in expansion of macro 'DPRINT'
DPRINT("Here is my string %s",str);
^~~~~~
In file included from C:/Users//.platformio/packages/framework-arduinoespressif32/cores/esp32/Stream.h:26,
from C:/Users//.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:177,
from src/main.cpp:2:
C:/Users//.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:81:12: note: candidate: 'size_t Print::print(const __FlashStringHelper*)'
size_t print(const __FlashStringHelper *);
^~~~~
C:/Users//.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:81:12: note: candidate expects 1 argument, 2 provided
C:/Users//.platformio/packages/framework-arduinoespressif32/cores/esp32/Print.h:82:12: note: candidate: 'size_t Print::print(const String&)'
size_t print(const String &);

SSL - An invalid SSL record was received

I have been trying to interface with Google App Script using this library to read my calendar. I am following the examples I have found online. I have published my Google script as a web app and it returns the desired result in the browser on the PC. However, I cannot get the same result on the ESP32.

This is the particular project I am following and on which I have based the code in my sketch. Admittedly the author of this project is using an ESP8266 but there are a number of other very similar examples of the use of the HTTPSRedirect library online:
https://github.com/SensorsIot/Reminder-with-Google-Calender/tree/master/ReminderV2

The function that is called from setup() function and makes and initial connection to the Google host works fine but shows the following warning when the log level is set to 'debug':

[I][ssl_client.cpp:127] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!

This is to be expected since the sketch includes a call to the .setInsecure() method. However, the second function that is called from void loop() does not work and hangs at the GET request. I see the following error returned:

[E][ssl_client.cpp:36] _handle_error(): [data_to_read():287]: (-29184) SSL - An invalid SSL record was received

I have checked that the URL is being formed correctly and also tried adding delays but this has made no difference. Unfortunately I can't get past this point.

The full output in serial monitor looks like this:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
MAC address: 30:AE:A4:FF:0B:D8
Starting WiFi client [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:419] _eventCallback(): STA IP: 10.210.210.76, MASK: 255.255.255.192, GW: 10.210.210.125
.
IP address: 10.210.210.76
Getting time from NTP server...
Done.
Connecting to script.google.com
Attempt: 0
[I][ssl_client.cpp:127] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
Finished FOR
Connected to Google
Start Request...
[I][ssl_client.cpp:127] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
Connected.
[I][ssl_client.cpp:127] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[E][ssl_client.cpp:36] _handle_error(): [data_to_read():287]: (-29184) SSL - An invalid SSL record was received

I have tried ESP32 library versions 1.0.4, 1.0.5 and 1.0.6. I had to remove the .setInsecure() line to make it compile with library version 1.0.4. I attempted to add the Google CA certificates at one point, but couldn't get this to work either. I think at least two certificates are required but am not sure how to add multiple certificates? Since none of the examples online seem to have any certificates included, I figured this ought not to be necessary so gave up on the idea and commented out the added lines.

Upload of complete sketch:
Calendar-Clock.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.