Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/ESP8266httpUpdate/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP8266httpUpdate
version=1.1
version=1.2
author=Markus Sattler
maintainer=Markus Sattler
sentence=Http Update for ESP8266
Expand Down
8 changes: 7 additions & 1 deletion libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ESP8266HTTPUpdate
{
public:
ESP8266HTTPUpdate(void);
ESP8266HTTPUpdate(int httpClientTimeout);
~ESP8266HTTPUpdate(void);

void rebootOnUpdate(bool reboot)
Expand Down Expand Up @@ -103,6 +104,8 @@ class ESP8266HTTPUpdate

int _lastError;
bool _rebootOnUpdate = true;
private:
int _httpClientTimeout;
};

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_HTTPUPDATE)
Expand Down