commit 6781a1c1cf24f597fcc7fff950ec2730d570f366
parent 2fd39771d23ca21bce9ee4281dec3d47c596f180
Author: hhvn <dev@hhvn.uk>
Date: Mon, 17 Jan 2022 12:55:27 +0000
configure zygo.c: gophers:// uris are errors without tls
Diffstat:
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
@@ -14,6 +14,7 @@ ${CC} -ltls -o test test.c >/dev/null 2>/dev/null && {
printf '%s\n' "yes"
cat >> config.mk <<- EOF
# libretls or libtls (standalone tls.h implementation) configuration
+ CFLAGS += -DTLS
LDFLAGS += -ltls
SRC += tls.c
EOF
diff --git a/zygo.c b/zygo.c
@@ -195,8 +195,15 @@ uritoelem(const char *uri) {
if (strncmp(tmp, "gopher://", strlen("gopher://")) == 0) {
tmp += strlen("gopher://");
} else if (strncmp(tmp, "gophers://", strlen("gophers://")) == 0) {
+#ifdef TLS
ret->tls = 1;
tmp += strlen("gophers://");
+#else
+ error("TLS support not compiled");
+ free(ret);
+ ret = NULL;
+ goto end;
+#endif /* TLS */
} else if (strstr(tmp, "://")) {
error("non-gopher protocol entered");
free(ret);