@brief HTTP handler for GET requests to root path (serves upload page) @param req HTTP request handle @return ESP_OK on success
| 453 | /// @param req HTTP request handle |
| 454 | /// @return ESP_OK on success |
| 455 | esp_err_t otaHttpGetHandler(httpd_req_t *req) { |
| 456 | // Get HTTP context from user context |
| 457 | OTAHttpContext* ctx = (OTAHttpContext*)req->user_ctx; |
| 458 | const char* password = ctx->password; |
| 459 | |
| 460 | // Check authentication |
| 461 | if (!checkBasicAuth(req, password)) { |
| 462 | return ESP_OK; // Response already sent by checkBasicAuth |
| 463 | } |
| 464 | |
| 465 | // Authentication successful - serve the OTA upload page |
| 466 | httpd_resp_set_type(req, "text/html"); |
| 467 | httpd_resp_send(req, getOtaHtmlPage(), HTTPD_RESP_USE_STRLEN); |
| 468 | return ESP_OK; |
| 469 | } |
| 470 | |
| 471 | /// @brief HTTP handler for POST requests to /update (firmware upload) |
| 472 | /// @param req HTTP request handle |
nothing calls this directly
no test coverage detected