[hackers] [quark][PATCH] Fix docindex not being served

From: José Miguel Sánchez García <soy.jmi2k_AT_gmail.com>
Date: Thu, 1 Oct 2020 21:04:04 +0000

Previously, when a directory was requested, the index body was not sent,
and the MIME type defaulted to "application/octet-stream".
---
 http.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/http.c b/http.c
index f1e15a4..2d3f17f 100644
--- a/http.c
+++ b/http.c
_AT_@ -738,6 +738,12 @@ http_prepare_response(const struct request *req, struct response *res,
 				    S_FORBIDDEN : S_NOT_FOUND;
 				goto err;
 			}
+		} else {
+			if (esnprintf(res->path, sizeof(res->path), "%s%s",
+			    vhost ? vhost->dir : "", RELPATH(tmpuri))) {
+				s = S_REQUEST_TOO_LARGE;
+				goto err;
+			}
 		}
 	}
 
_AT_@ -778,7 +784,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;
-- 
2.28.0
Received on Thu Oct 01 2020 - 23:04:04 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 01 2020 - 21:12:34 CEST