Skip to content

Commit

Permalink
Don't allow flashing in AP mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson committed Oct 9, 2024
1 parent 339fbcb commit 5bee5b0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main/http_server/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ static esp_err_t GET_system_info(httpd_req_t * req)

esp_err_t POST_WWW_update(httpd_req_t * req)
{
wifi_mode_t mode;
esp_wifi_get_mode(&mode);
if (mode == WIFI_MODE_AP || mode == WIFI_MODE_APSTA)
{
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Not allowed in AP mode");
return ESP_FAIL;
}

char buf[1000];
int remaining = req->content_len;

Expand Down Expand Up @@ -521,6 +529,14 @@ esp_err_t POST_WWW_update(httpd_req_t * req)
*/
esp_err_t POST_OTA_update(httpd_req_t * req)
{
wifi_mode_t mode;
esp_wifi_get_mode(&mode);
if (mode == WIFI_MODE_AP || mode == WIFI_MODE_APSTA)
{
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Not allowed in AP mode");
return ESP_FAIL;
}

char buf[1000];
esp_ota_handle_t ota_handle;
int remaining = req->content_len;
Expand Down

0 comments on commit 5bee5b0

Please sign in to comment.