From bc37b48186ddccb57923bfc5dabd7ddbafcbdd3e Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 4 Nov 2022 15:07:01 +0200 Subject: [PATCH] added direct handle of gzipped files --- src/HTTPServer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/HTTPServer.c b/src/HTTPServer.c index 9adf395..d617898 100644 --- a/src/HTTPServer.c +++ b/src/HTTPServer.c @@ -315,8 +315,13 @@ static esp_err_t GETHandler(httpd_req_t *req) file = espfs_fopen(fs, filepath); if (!file) { - httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "File not found"); - return ESP_FAIL; + strcat(filepath, ".gz"); //check if requested file in gzip archive + file = espfs_fopen(fs, filepath); + if (!file) + { + httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "File not found"); + return ESP_FAIL; + } } //get file info espfs_stat(fs, filepath, &stat);