Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

FirebaseArduino: switch to ArduinoHttpClient #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

proppy
Copy link
Contributor

@proppy proppy commented Jun 15, 2018

Preliminary work to port the library to use ArduinoHttpClient.
This will enable the library to be portable across arduino cores implementing the Client Interface.

  • ✔️ compile for esp8266
  • ✔️ compile for esp32
  • ✔️ CRUD tested on esp8266
  • ✔️ CRUD tested on esp32
  • ⚠️ streaming not tested on esp8266
  • ⚠️ streaming not tested on esp32

Note this breaks the following libraries/sketches:

  • FirebaseCloudMessaging
  • contrib/modem
  • contrib/things

And obsolete the following classes:

  • Firebase
  • FirebaseHttpClient

Testing welcome 🎠

Related #344 #220

/cc @ed7coyne @kotl

This allow the library to be portable across arduino core implementing
the Client Interface.

Fixes FirebaseExtended#344
@kotl
Copy link
Collaborator

kotl commented Jun 21, 2018

You may remember this, but I wanted to remind you that for ESP8266 implementation, please be extra careful about our use of workaround for ESP8266 of modifying _canReuse even after it was set to false in

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp#L1020

Through these lines:
if(headerName.equalsIgnoreCase("Connection")) {
_canReuse = headerValue.equalsIgnoreCase("keep-alive");
}
(Since RTDB tends to not send "keep-alive" value)

We change _canReuse value early enough, so that before HTTPClient::end is called, it is set to true.
However, we can't override HTTPClient::end() since it's not virtual and luckily for us, we never call HTTPClient::end, and it is also not called in HTTPClient implementation, therefore when we call ForceReuseHTTPClient::end, it works.

We will need to have same workaround for ESP8266 implementation using ArduinoHttpClient if RTDB is still acting in the same way.

@proppy
Copy link
Contributor Author

proppy commented Jun 21, 2018

@kotl Oh right, I forgot about this!

We're lucky as It seems that ArduinoHttpClient header handling doesn't parse "Connection: close":
https://github.com/arduino-libraries/ArduinoHttpClient/blob/master/src/HttpClient.cpp#L763

@proppy
Copy link
Contributor Author

proppy commented Aug 8, 2018

@kotl did you give it a try?

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants