mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 20:46:52 +03:00
Fix cookie usage, use correct http response codes, add 404 page (#1495)
* replaced some HTTP response code with better matching codes * add custom 404 page, add log entry for debugging * fix cookie * replace non-necessary whitespace * . Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
@@ -36,13 +36,13 @@ esp_err_t send_file(httpd_req_t *req, std::string filename)
|
||||
{
|
||||
FILE *fd = OpenFileAndWait(filename.c_str(), "r");
|
||||
if (!fd) {
|
||||
ESP_LOGE(TAG, "Failed to read existing file : %s", filename.c_str());
|
||||
/* Respond with 500 Internal Server Error */
|
||||
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to read existing file");
|
||||
ESP_LOGE(TAG, "Failed to read existing file: %s", filename.c_str());
|
||||
/* Respond with 404 Error */
|
||||
httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404());
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Sending file : %s ...", filename.c_str());
|
||||
ESP_LOGD(TAG, "Sending file: %s ...", filename.c_str());
|
||||
// httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
||||
set_content_type_from_file(req, filename.c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user