| Adding gopher+ compatibility. - geomyidae - A small C-based gopherd. | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit a1cdda3a103efbe3da4dfed6b2b26301d1b83757 | |
| parent 1ee9a83904a0077b273014297bd5ca0a1d076148 | |
| Author: Christoph Lohmann <[email protected]> | |
| Date: Tue, 30 Jan 2018 22:21:42 +0100 | |
| Adding gopher+ compatibility. | |
| Diffstat: | |
| M 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 *por… | |
| 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… | |
| return; | |
| } | |
| - sear = strchr(recvb, '\t'); | |
| - if (sear != nil) | |
| - *sear++ = '\0'; | |
| args = strchr(recvb, '?'); | |
| if (args != nil) | |
| *args++ = '\0'; |