commit 2fd39771d23ca21bce9ee4281dec3d47c596f180
parent f97ea2ebaa7e66b59e1047dea6401e8f63dccb27
Author: hhvn <dev@hhvn.uk>
Date: Mon, 17 Jan 2022 02:27:39 +0000
zygo.c: only carry tls forward if server/port are the same
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/zygo.c b/zygo.c
@@ -263,7 +263,6 @@ gophertoelem(Elem *from, const char *line) {
int seg;
ret = emalloc(sizeof(Elem));
- ret->tls = from ? from->tls : 0;
ret->type = *(tmp++);
ret->desc = ret->selector = ret->server = ret->port = NULL;
@@ -283,6 +282,13 @@ gophertoelem(Elem *from, const char *line) {
}
ret->port = estrdup(tmp);
+ if (from && from->tls &&
+ strcmp(ret->server, from->server) == 0 &&
+ strcmp(ret->port, from->port) == 0)
+ ret->tls = 1;
+ else
+ ret->tls = 0;
+
free(dup);
return ret;