-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/http update wi fi client parameter #4980
Feature/http update wi fi client parameter #4980
Conversation
…TTPUpdate_WiFiClient_parameter
…ient parameter and added secure update example
…tion that only one connection is made, updated version to 1.2 deprecating present begin() functions, several minor updates
…ed function 2nd try
…ed function 3rd try
…ed function 4th try
… functions. Adaptations to work with new ESP8266hhtpClient are made in PR #4980
…TTPUpdate_WiFiClient_parameter
Thanks very much for your time with this confirmation ! |
Sure! All 3 examples updated in this PR with the usage of setLedPin() and a comment on how to use it |
@d-a-v You're welcome, happy to help! I am glad that the lwIP devs SACKed us ;) |
You had a trailing space in a comment, causing the CI style_check to fail. Fixed it for you. |
I just tried this code with the original example code (simulating someone running their existing app) and it looks like the
|
Actually, I see the old sample code was silly and required a local 192.168.x.x server. Changing the server to one that exists doesn't change the results, unfortunately:
|
Original code output (StreamHTTPClient with the URL moved to the jigsaw.w3.org server)
|
The `_client==NULL` check was performed before any `_client` could be set by the shim code. Move the check past where the shim code actually sets the variable. Fixes any unmodified legacy code and the old samples.
@Jeroen88, hope you don't mind but the fix was simple so I just moved the problem NULL check to after the _client is actually set and committed. Now old samples seem to work fine with the new class. |
@earlephilhower the check for _client should indeed be after the assignment, thnx for the fix! |
@earlephilhower did you see my comment:
This is with streamHttpsClient.ino. Any suggestions? |
@Jeroen88, I'm going to commit this now, but if after this is committed you pull git head and still see the crash open an issue and we can look at it. I'm running the StreamHTTPSClient (i.e. BSSL) example now and it's running just fine, so I have no idea what you're seeing, unfortunately. |
The ESP8266 API for HTTPClient has a change in 2.5 that I believe has broken the chicken man. Specifically esp8266/Arduino#4980
Now that the ESP8266 call requires a
Or is there another easier way to make cross-platform code? |
@scottchiefbaker ESP32 HTTPClient supports the same ::begin() function as ESP8266HTTPClient as you can see here |
@scottchiefbaker you're welcome! |
Pass Client parameter to httpUpdate to use any BearSSL security method for a firmware update (with example). This PR replaces #4832.
This is a combination with PR #4979, because The ESP8266HTTPUpdate class uses the ESP8266HTTPClient class from this PR to pass the BearSLL WiFiClient.
Added two new update() and one updateSpiffs() function that uses the ESP8266HTTPClient adapted by me in PR #4825. With these adaptations, it is possible to do an encrypted and authenticated server firmware or SPIFFS update, using any of the supported security options of the WiFiClientSecureBearSSL library. httpUpdateSecure.ino is a complete example.
To try this, you need either a sketch with enough free memory to allocate the full TLS/SSL-buffer (16k), or a, currently not very widely supported Maximum Fragment Length Negotiation enabled, server (or do the same trick as I do, using a nodeJS server and set maxSendFragmentLength) that sends the correct response headers and serves the binary. You need a certificate store in SPIFFs that includes your root CA, or a self signed certificate, or a certificate fingerprint. In the latter two cases you need to edit the example to use allowSelfSignedCerts() or setFingerprint(). It is also possible to use encryption without server authentication. In this case use setInsecure(). Of course any of the other supported WiFiClientSecureBearSSL functions may be used as well.