aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--gmid.c7
-rw-r--r--gmid.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f61b0a..eeb786f 100644
--- a/ChangeLog
+++ b/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>
diff --git a/gmid.c b/gmid.c
index 0c1bed2..fca2ef6 100644
--- a/gmid.c
+++ b/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 ? "?" : "",
diff --git a/gmid.h b/gmid.h
index ecca57f..e145d1a 100644
--- a/gmid.h
+++ b/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