aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-12-09 20:59:05 +0000
committerOmar Polo <op@omarpolo.com>2021-12-09 20:59:05 +0000
commit52c92ef6803ae5bcf1eca0447b07da2f8ca675fb (patch)
tree6298b29cbefeb9d2d0ae463558ebe0873a883e27 /server.c
parent34c4ca6ebc5e71f50f5f8d52113b47b26573bfa1 (diff)
relax the "wont proxy request" check: don't check the port number
Don't refuse to serve the request if the port number doesn't match the one we're listening on, as initially suggested by Allen Sobot. Complex setup may have a gmid instance reachable from multiple ports and the meaning of the check in the first places was to avoid tricking clients into thinking that we're serving for those domains: the port number is way less important than the schema or domain name. In the long run, the best way would probably to add a `listen on' keyword for the servers blocks, just like OpenBSD' httpd, but gmid can't listen on multiple ports/interfaces yet
Diffstat (limited to 'server.c')
-rw-r--r--server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/server.c b/server.c
index 88fcc70..151ede7 100644
--- a/server.c
+++ b/server.c
@@ -963,8 +963,8 @@ client_read(struct bufferevent *bev, void *d)
return;
}
- if (c->iri.port_no != conf.port ||
- strcmp(c->iri.schema, "gemini") ||
+ /* ignore the port number */
+ if (strcmp(c->iri.schema, "gemini") ||
strcmp(decoded, c->domain)) {
start_reply(c, PROXY_REFUSED, "won't proxy request");
return;