diff options
author | Omar Polo <op@omarpolo.com> | 2021-01-11 14:45:57 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-01-11 14:45:57 +0000 |
commit | 7b1d97903280066059ed4b00d4d407876957d071 (patch) | |
tree | 0f3ee57dfbb2e3d0942cae1ab020e00aa8d82993 | |
parent | 6a9ae707737d978bccbabdc36beae509151a7be2 (diff) |
reject non-gemini protocols with 531.4
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | gmid.c | 7 | ||||
-rw-r--r-- | gmid.h | 1 |
3 files changed, 9 insertions, 0 deletions
@@ -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> @@ -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 ? "?" : "", @@ -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 |