Commit Diff


commit - 6a9ae707737d978bccbabdc36beae509151a7be2
commit + 7b1d97903280066059ed4b00d4d407876957d071
blob - 9f61b0aff0dab0178a16b36866f391fb13affdb5
blob + eeb786f8d51b392e15335853f07e50a811984eb1
--- ChangeLog
+++ ChangeLog
@@ -1,6 +1,7 @@
 2021-01-11  Omar Polo  <op@omarpolo.com>
 
 	* gmid.c (main): ipv6 disabled by default and -6 flag to enable it
+	(handle): reject non-gemini protocols with 53
 
 2021-01-10  Omar Polo  <op@omarpolo.com>
 
blob - 0c1bed23a05e30fef4ebcf534d1a0cc2e4bf455d
blob + fca2ef662bd2b2e417763ce5cc271db5b181109c
--- gmid.c
+++ gmid.c
@@ -600,6 +600,13 @@ handle(struct pollfd *fds, struct client *client)
 			return;
 		}
 
+		if (strcmp(iri.schema, "gemini")) {
+			if (!start_reply(fds, client, PROXY_REFUSED, "won't proxy request"))
+				return;
+			goodbye(fds, client);
+			return;
+		}
+
 		LOGI(client, "GET %s%s%s",
 		    *iri.path ? iri.path : "/",
 		    *iri.query ? "?" : "",
blob - ecca57ffd095eb684a593403e0f0f25964f70438
blob + e145d1a626088989b5738e140f7480da9c5fac93
--- gmid.h
+++ gmid.h
@@ -45,6 +45,7 @@
 #define SUCCESS		20
 #define TEMP_FAILURE	40
 #define NOT_FOUND	51
+#define PROXY_REFUSED	53
 #define BAD_REQUEST	59
 
 #define MAX_USERS	64