hermes

HTTP GET/HEAD-only web server for static content.
git clone git://git.francescosaccone.com/hermes
Log | Files | Refs | README | LICENSE

commit 2944a697ac4add003fb682eaa584964309cb45f3
parent 2f0f372565eb3f2ccac6a5260d3d8d71af53eb76
Author: Francesco Saccone <francesco@francescosaccone.com>
Date:   Tue,  1 Apr 2025 10:44:23 +0200

feat: remove trailing slash when normalising paths

Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>

Diffstat:
Mfile.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/file.c b/file.c @@ -31,7 +31,8 @@ get_normalised_path(char *path) { if (path[i] != '/' || /* In the following conditions, we have path[i] == '/'. */ i == 0 || /* Keep leading slash */ - path[i - 1] != '/'/* No continous slashes */) { + path[i - 1] != '/' || /* No continous slashes */ + path[i + 1] != '\0' /* No trailing slash */) { normalised[j] = path[i]; j++; }