~sircmpwn/gmni-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] Check index before serving autoindex

Karmanyaah Malhotra <karmanyaahm@gmail.com>
Details
Message ID
<20210621075306.1500391-1-karmanyaahm@gmail.com>
DKIM signature
pass
Download raw message
Patch: +6 -6
if a directory is being served.
---
 src/serve.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/serve.c b/src/serve.c
index 6ad79341..bcbef5c7 100644
--- a/src/serve.c
+++ b/src/serve.c
@@ -526,15 +526,16 @@ serve_request(struct gmnisrv_client *client)
		}

		if (S_ISDIR(st.st_mode)) {
			if (route->autoindex) {
				serve_autoindex(client, real_path);
				free(url_path);
				return;
			} else {
				strcpy(temp_path, real_path);
				strncat(real_path,
					route->index ? route->index : "index.gmi",
					sizeof(real_path) - 1);
				if (stat(real_path, &st) != 0) {
					if (route->autoindex) {
						serve_autoindex(client, temp_path);
						free(url_path);
						return;
					}
					server_error("CGI path %s has no index",
						client_path);
					client_submit_response(client,
@@ -542,7 +543,6 @@ serve_request(struct gmnisrv_client *client)
						"Not found", NULL);
					return;
				}
			}
		} else if (S_ISLNK(st.st_mode)) {
			++nlinks;
			if (nlinks > 3) {
-- 
2.32.0
Karmanyaah Malhotra <karmanyaahm@gmail.com>
Details
Message ID
<d98db0fa-72bf-1aa4-a118-5307ec7c8793@gmail.com>
In-Reply-To
<20210621075306.1500391-1-karmanyaahm@gmail.com> (view parent)
DKIM signature
pass
Download raw message
Currently in my experience when enabled, autoindex is rendered
regardless of whether an index.gmi is present.
-- 
Karmanyaah Malhotra
https://karmanyaah.malhotra.cc/contact/
gemini://karmanyaah.malhotra.cc
Details
Message ID
<CC9AZBKJVCJ0.N9BQW9MNCOPQ@taiga>
In-Reply-To
<20210621075306.1500391-1-karmanyaahm@gmail.com> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks!

To git@git.sr.ht:~sircmpwn/gmnisrv
   32854b7..9f2481d  master -> master
Reply to thread Export thread (mbox)