Skip to content

Commit 63caf0c

Browse files
committed
Update HTTPUpdate.cpp
1 parent 8dc70e0 commit 63caf0c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

libraries/HTTPUpdate/src/HTTPUpdate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ HTTPUpdateResult HTTPUpdate::handleUpdate(HTTPClient& http, const String& curren
175175
// use HTTP/1.0 for update since the update handler not support any transfer Encoding
176176
http.useHTTP10(true);
177177
http.setTimeout(_httpClientTimeout);
178+
http.setFollowRedirects(_followRedirects);
178179
http.setUserAgent("ESP32-http-Update");
179180
http.addHeader("Cache-Control", "no-cache");
180181
http.addHeader("x-ESP32-STA-MAC", WiFi.macAddress());

libraries/HTTPUpdate/src/HTTPUpdate.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ class HTTPUpdate
6363
{
6464
_rebootOnUpdate = reboot;
6565
}
66+
67+
/**
68+
* set redirect follow mode. See `followRedirects_t` enum for avaliable modes.
69+
* @param follow
70+
*/
71+
void setFollowRedirects(followRedirects_t follow)
72+
{
73+
_followRedirects = follow;
74+
}
6675

6776
void setLedPin(int ledPin = -1, uint8_t ledOn = HIGH)
6877
{
@@ -89,6 +98,7 @@ class HTTPUpdate
8998
bool _rebootOnUpdate = true;
9099
private:
91100
int _httpClientTimeout;
101+
followRedirects_t _followRedirects = HTTPC_DISABLE_FOLLOW_REDIRECTS;
92102

93103
int _ledPin;
94104
uint8_t _ledOn;

0 commit comments

Comments
 (0)