check also that the port number matches

This commit is contained in:
Omar Polo 2021-01-15 18:24:24 +00:00
parent f7b816dc39
commit b777bf4b2b
2 changed files with 3 additions and 2 deletions

2
gmid.c
View File

@ -639,7 +639,7 @@ handle_open_conn(struct pollfd *fds, struct client *c)
return;
}
if (strcmp(iri.schema, "gemini")) {
if (strcmp(iri.schema, "gemini") || iri.port_no != conf.port) {
if (!start_reply(fds, c, PROXY_REFUSED, "won't proxy request"))
return;
goodbye(fds, c);

3
iri.c
View File

@ -160,7 +160,8 @@ parse_authority(struct parser *p)
*p->iri = '\0';
p->iri++;
return parse_port(p);
}
} else
p->parsed->port_no = 1965;
if (*p->iri == '/') {
*p->iri = '\0';