commit 87ae2e9212c5cc7309eefa2a3f49a758862db6c7
Author: Laslo Hunhold <[email protected]>
AuthorDate: Sun Jan 24 18:37:03 2021 +0100
Commit: Laslo Hunhold <[email protected]>
CommitDate: Sun Jan 24 18:37:03 2021 +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]>
diff --git a/http.c b/http.c
index dc32290..c11e367 100644
--- a/http.c
+++ b/http.c
@@ -760,6 +760,13 @@ http_prepare_response(const struct request *req, struct
response *res,
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
response *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;