mirror of
https://github.com/esphome/esphome.git
synced 2026-02-21 00:45:35 -07:00
reduce
This commit is contained in:
@@ -52,7 +52,13 @@ void CaptivePortal::handle_wifisave(AsyncWebServerRequest *request) {
|
||||
ESP_LOGI(TAG, " Password=" LOG_SECRET("'%s'"), psk.c_str());
|
||||
wifi::global_wifi_component->save_wifi_sta(ssid, psk);
|
||||
wifi::global_wifi_component->start_scanning();
|
||||
request->redirect(ESPHOME_F("/?save"));
|
||||
|
||||
// Add Connection: close header to ensure socket is released immediately
|
||||
// Without this, sockets can stay in TIME_WAIT and exhaust the socket pool
|
||||
auto *response = request->beginResponse(302, ESPHOME_F("text/plain"), ESPHOME_F(""));
|
||||
response->addHeader(ESPHOME_F("Location"), ESPHOME_F("/?save"));
|
||||
response->addHeader(ESPHOME_F("Connection"), ESPHOME_F("close"));
|
||||
request->send(response);
|
||||
}
|
||||
|
||||
void CaptivePortal::setup() {
|
||||
|
||||
Reference in New Issue
Block a user