geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit a1cdda3a103efbe3da4dfed6b2b26301d1b83757
parent 1ee9a83904a0077b273014297bd5ca0a1d076148
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue, 30 Jan 2018 22:21:42 +0100

Adding gopher+ compatibility.

Diffstat:
main.c | 17++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c @@ -130,6 +130,20 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth, c = strchr(recvb, '\n'); if (c) c[0] = '\0'; + sear = strchr(recvb, '\t'); + if (sear != nil) { + *sear++ = '\0'; + + /* Gopher+ compatibility hack. */ + if (*sear == '+' || *sear == '$' || *sear == '!') { + dprintf(sock, "+-2\r\n"); + dprintf(sock, "+INFO: 1gopher+\t\t%s\t%s\r\n", + ohost, port); + dprintf(sock, "+ADMIN:\r\n Admin: Me\r\n"); + return; + } + } + memmove(recvc, recvb, len+1); if (!strncmp(recvb, "URL:", 4)) { @@ -143,9 +157,6 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth, return; } - sear = strchr(recvb, '\t'); - if (sear != nil) - *sear++ = '\0'; args = strchr(recvb, '?'); if (args != nil) *args++ = '\0';