reject non-gemini protocols with 53

This commit is contained in:
Omar Polo 2021-01-11 14:45:57 +00:00
parent 6a9ae70773
commit 7b1d979032
3 changed files with 9 additions and 0 deletions

View File

@ -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>

7
gmid.c
View File

@ -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 ? "?" : "",

1
gmid.h
View File

@ -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