Redirect directory requests to dirplex to always include a trailing slash.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 24 Aug 2010 19:40:24 +0000 (21:40 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 24 Aug 2010 19:40:24 +0000 (21:40 +0200)
src/dirplex.c

index c612c15..699819f 100644 (file)
@@ -413,6 +413,10 @@ static void serve(struct hthead *req, int fd)
                else
                    path = sprintf2("%s/%s", path, p);
                free(tmp);
+               if(p2 == NULL) {
+                   stdredir(req, fd, 301, sprintf3("%s/", p));
+                   goto out;
+               }
                if(checkdir(req, fd, path))
                    break;
                goto next;