From 85bd9816830a8d57a589f8621ac6e09ab60052b4 Mon Sep 17 00:00:00 2001 From: ueJone <775844993@qq.com> Date: Fri, 21 Mar 2025 10:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A0=E8=BD=BD=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=A1=B5=E9=9D=A2(index.html./index.htm)=E5=90=AF?= =?UTF-8?q?=E7=94=A8GZIP=E5=90=8Ehttp=E6=8A=A5404=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/wn_module.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/wn_module.c b/src/wn_module.c index 24d2396..f1a8c56 100644 --- a/src/wn_module.c +++ b/src/wn_module.c @@ -562,7 +562,24 @@ int webnet_module_handle_uri(struct webnet_session *session) { break; } +#ifdef WEBNET_USING_GZIP + if (request->support_gzip) + { + int len = strlen(full_path); + if(len + sizeof(".gz") < WEBNET_PATH_MAX) + { + rt_memcpy(&full_path[len], ".gz", sizeof(".gz")); + + if (stat(full_path, &file_stat) >= 0 && !S_ISDIR(file_stat.st_mode)) + { + /* remove .gz */ + full_path[len] = '\0'; + break; + } + } + } +#endif /* WEBNET_USING_GZIP */ index ++; } _end_default_files: