Clarify gopher+ compatibility handling. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
Log
Files
Refs
Tags
README
LICENSE
---
commit 2a482d9af02b09bc8a770c4e08be577264d473c5
parent 7b9aa6de08d6ed822f5917c44bf61e10a804b31b
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 22 Jul 2023 15:57:20 +0200

Clarify gopher+ compatibility handling.

Diffstat:
  M main.c                              |       5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/main.c b/main.c
@@ -199,7 +199,10 @@ handlerequest(int sock, char *req, int rlen, char *base, char *ohost,
                  * mode. DO NOT ADD ANY OTHER GOPHER+ SUPPORT. GOPHER+ IS
                  * CRAP.
                  */
-                if (*sear == '+' || *sear == '$' || *sear == '!' || *sear == '\0') {
+                if ((sear[0] == '+' && sear[1] == '\0')
+                                || (sear[0] == '$' && sear[1] == '\0')
+                                || (sear[0] == '!' && sear[1] == '\0')
+                                || sear[0] == '\0') {
                         if (loglvl & GPLUS)
                                 logentry(clienth, clientp, recvb, "gopher+ redirect");
                         dprintf(sock, "+-2\r\n");