Skip to content

Commit

Permalink
reject non-gemini protocols with 53
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-polo committed Jan 11, 2021
1 parent 6a9ae70 commit 7b1d979
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2021-01-11 Omar Polo <[email protected]>

* 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 <[email protected]>

Expand Down
7 changes: 7 additions & 0 deletions gmid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "?" : "",
Expand Down
1 change: 1 addition & 0 deletions gmid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b1d979

Please sign in to comment.