1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-09-06 19:08:12 +03:00

add http client configurable timeout usefull when download is slow on server side (#4705)

* add http client configurable timeout usefull when download is slow from server side

* member init outside constructor body.

* removed this.
This commit is contained in:
Marian Craciunescu
2018-05-04 17:18:15 +03:00
committed by Develo
parent 76a14b1f63
commit bd87970aae
3 changed files with 11 additions and 2 deletions

View File

@@ -30,6 +30,12 @@ extern "C" uint32_t _SPIFFS_start;
extern "C" uint32_t _SPIFFS_end;
ESP8266HTTPUpdate::ESP8266HTTPUpdate(void)
: _httpClientTimeout(8000)
{
}
ESP8266HTTPUpdate::ESP8266HTTPUpdate(int httpClientTimeout)
: _httpClientTimeout(httpClientTimeout)
{
}
@@ -170,7 +176,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
// use HTTP/1.0 for update since the update handler not support any transfer Encoding
http.useHTTP10(true);
http.setTimeout(8000);
http.setTimeout(_httpClientTimeout);
http.setUserAgent(F("ESP8266-http-Update"));
http.addHeader(F("x-ESP8266-STA-MAC"), WiFi.macAddress());
http.addHeader(F("x-ESP8266-AP-MAC"), WiFi.softAPmacAddress());