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
@@ -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;
+                       }
                }
        }
 
@@ -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


Reply via email to