Fix directory-index-handling - quark - quark web server | |
git clone git://git.suckless.org/quark | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 87ae2e9212c5cc7309eefa2a3f49a758862db6c7 | |
parent f3b6d5efc375bedd287897dcaabffec7f9222ea6 | |
Author: Laslo Hunhold <[email protected]> | |
Date: Sun, 24 Jan 2021 18:37:03 +0100 | |
Fix directory-index-handling | |
Previously, quark would properly check for the docindex-path, but not | |
actually change the response-struct accordingly. I missed this during | |
the restructurization of the code. | |
Thanks to Quentin Rameau for spotting this issue! This commit is based | |
on his patch. | |
Signed-off-by: Laslo Hunhold <[email protected]> | |
Diffstat: | |
M http.c | 9 ++++++++- | |
1 file changed, 8 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/http.c b/http.c | |
@@ -760,6 +760,13 @@ http_prepare_response(const struct request *req, struct re… | |
S_FORBIDDEN : S_NOT_FOUND; | |
goto err; | |
} | |
+ } else { | |
+ /* docindex is valid, write tmpuri to response-path */ | |
+ if (esnprintf(res->path, sizeof(res->path), "%s", | |
+ tmpuri)) { | |
+ s = S_REQUEST_TOO_LARGE; | |
+ goto err; | |
+ } | |
} | |
} | |
@@ -800,7 +807,7 @@ http_prepare_response(const struct request *req, struct res… | |
/* mime */ | |
mime = "application/octet-stream"; | |
- if ((p = strrchr(realuri, '.'))) { | |
+ if ((p = strrchr(res->path, '.'))) { | |
for (i = 0; i < LEN(mimes); i++) { | |
if (!strcmp(mimes[i].ext, p + 1)) { | |
mime = mimes[i].type; |