mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-05 13:16:13 +03:00
Add url redirect (#8970)
* added getAvailableVersion(), moved _httpClientTimeout and _followRedirects to protected, added enum HTTPUpdateError * auto numbering of HTTPUpdateError enum * added getAvailableVersion(), debug output current current Sketch MD5 * Revert "added getAvailableVersion(), debug output current current Sketch MD5" This reverts commit60d2c7762e
. * Revert "auto numbering of HTTPUpdateError enum" This reverts commit61785b27da
. * Revert "added getAvailableVersion(), moved _httpClientTimeout and _followRedirects to protected, added enum HTTPUpdateError" This reverts commitcec84ed17a
. * add redirect function * enhanced redirect() by cache control and client stop * updated redirect() comment * replaced redirect() API calls in examples * server.client().stop() not needed, redirect() does this
This commit is contained in:
@@ -36,13 +36,11 @@ void sendPortalRedirect(String path, String targetName) {
|
||||
If the "Location" header element works the HTML stuff is never seen.
|
||||
*/
|
||||
// https://tools.ietf.org/html/rfc7231#section-6.4.3
|
||||
server.sendHeader("Location", path, true);
|
||||
addNoCacheHeader();
|
||||
String reply = FPSTR(portalRedirectHTML);
|
||||
reply.reserve(reply.length() + 2 * path.length() + 80);
|
||||
reply.replace("{t}", targetName);
|
||||
reply.replace("{1}", path);
|
||||
server.send(302, "text/html", reply);
|
||||
server.redirect(path, reply);
|
||||
}
|
||||
|
||||
#endif // LWIP_FEATURES && !LWIP_IPV6
|
||||
|
Reference in New Issue
Block a user