[hackers] [quark] http: fix default index serving

From: Quentin Rameau <quinq_AT_fifth.space>
Date: Sun, 17 Jan 2021 14:41:55 +0100

The previous code would find and stat the default index file,
but would not append it to the file served, resulting in
giving back a 0-length content but with a Content-Length
header of the size of the index.
---
 http.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/http.c b/http.c
index dc32290..96dd540 100644
--- a/http.c
+++ b/http.c
_AT_@ -761,6 +761,11 @@ http_prepare_response(const struct request *req, struct response *res,
 				goto err;
 			}
 		}
+		/* copy the found index back to the final path */
+		if (esnprintf(res->path, sizeof(res->path), "%s", tmpuri)) {
+			s = S_REQUEST_TOO_LARGE;
+			goto err;
+		}
 	}
 
 	/* modified since */
-- 
2.28.0
Received on Sun Jan 17 2021 - 14:41:55 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 17 2021 - 14:48:37 CET