-
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
Make HTTPClient suitabe for any Client #4825
Make HTTPClient suitabe for any Client #4825
Conversation
Travis build failed because I set the current API deprecated, this generates the failure:
|
I suggest not marking the current api as deprecated just yet. There are several things that should happen before that. I think the steps to follow should be:
|
For now, I removed the deprecated from the current api. I will have a look at the examples to migrate them to the new api. @devyte How do I merge the new api as experimental? |
Travis build failed because several macro's are redefined, however, not in my scope, e.g.
|
The examples are migrated to new api as @devyte suggested. A https example with Maximum Fragment Length Negotiation (MFLN) is added. If MFLN is supported by the server, the ESP8266 client needs for a SSL/TLS connection are significantly reduced. MFLN is part of the upcoming LTS release of OpenSSL 1.1.1. The URL in the example already supports MFLN. |
…ure/httpclient_client_parameter
…com/Jeroen88/Arduino into feature/httpclient_client_parameter
…eBearSSL example using MFLN
One unexpected issue I just ran into was that the destructor for ESP8266WifiClient calls a method on the Client* passed in. If you've allocated ESPHTTPClient on the stack so its scoped to the local function and allocate the WiFiClient passed in like: (simplified/contrived code) void doit(const char* url) {
WiFiClient *client = new WiFiClient;
ESP8266HTTPClient http;
http.begin(*client, "http://www.example.com");
http.end();
delete client;
} Then the client pointer saved in I bring this up because its an easy issue to create if your checking the url and creating either a |
@liebman Thanks for your comment! I made a small modification on the end() function. Could you check if your bug is fixed? |
Replaced with #4979 |
Adaptation to HTTPClient as suggested by @igrr on April 10 in PR #4273 and discussed with @earlephilhower by e-mail:
Example usage:
If the server supports Maximum Fragment Length negotiation, the following code can be used, reducing the memory needs very significantly: