Enable gopher+ support only if `-+' is passed - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 6aec2451ef322136d75a99b17b408728b1dde3c1
(DIR) parent 849f6154b70090657232e3da34118ec9b73cb322
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sun, 26 May 2019 00:05:19
Enable gopher+ support only if `-+' is passed
Diffstat:
wip/Geomyidae-git/patch-dogpcompat.patch | 94 ++++++++++++++++++++++++++++++++
1 files changed, 94 insertions(+), 0 deletions(-)
---
diff -r 849f6154b700 -r 6aec2451ef32 wip/Geomyidae-git/patch-dogpcompat.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wip/Geomyidae-git/patch-dogpcompat.patch Sun May 26 00:05:19 2019 +0200
@@ -0,0 +1,94 @@
+Disable gopher+ compatibility by default and add a `-+' option to enable it.
+
+--- geomyidae.8
++++ geomyidae.8
+@@ -11,6 +11,7 @@
+ .Sh SYNOPSIS
+ .Nm
+ .Bk -words
++.Op Fl +
+ .Op Fl 4
+ .Op Fl 6
+ .Op Fl c
+@@ -84,6 +85,10 @@ source archive.
+ geomyidae options and default settings:
+ .Bl -tag -width Ds
+ .
++.It Fl +
++Enable compatibility layer for gopher(1) client requesting gopher+
++metadata by default (see QUIRK).
++.
+ .It Fl 4
+ Only use IPv4.
+ .
+@@ -341,11 +346,11 @@ surprises depending on how a script is written. See the CGI file (included
+ in the geomyidae source archive) for further elaboration.
+ .Pp
+ QUIRK: The original gopher client tried to be too intelligent. It is using
+-gopher+ when you request some resource. When "search" is just the value "+",
+-"!", "$" or empty, geomyidae will display a gopher+ redirect instead of invoking the
+-script. Be careful to design your search script so the user is unlikely to
+-enter those values. The designers of gopher+ did not think of classic gopher
+-to survive. It survived gopher+.
++gopher+ when you request some resource. When -+ option is used and "search"
++start with value "+", "!", "$" or empty, geomyidae will display a gopher+
++redirect instead of invoking the script. Be careful to design your search
++script so the user is unlikely to enter those values. The designers of
++gopher+ did not think of classic gopher to survive. It survived gopher+.
+ .Pp
+ Additionally to the above arguments several environment variables are set.
+ .Pp
+--- main.c
++++ main.c
+@@ -116,7 +116,7 @@ logentry(char *host, char *port, char *qry, char *status)
+
+ void
+ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth,
+- char *clientp, int nocgi)
++ char *clientp, int nocgi, int dogpcompat)
+ {
+ struct stat dir;
+ char recvc[1025], recvb[1025], path[1025], *args, *sear, *c;
+@@ -153,7 +153,8 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth,
+ * mode. DO NOT ADD ANY OTHER GOPHER+ SUPPORT. GOPHER+ IS
+ * CRAP.
+ */
+- if (*sear == '+' || *sear == '$' || *sear == '!' || *sear == '\0') {
++ if (dogpcompat && (*sear == '+' || *sear == '$' ||
++ *sear == '!' || *sear == '\0')) {
+ dprintf(sock, "+-2\r\n");
+ dprintf(sock, "+INFO: 1gopher+\t\t%s\t%s\r\n",
+ ohost, port);
+@@ -397,8 +398,8 @@ main(int argc, char *argv[])
+ struct addrinfo hints;
+ struct sockaddr_storage clt;
+ socklen_t cltlen;
+- int sock, dofork, inetf, usechroot, nocgi, errno_save, nbindips, i, j,
+- nlfdret, *lfdret, listfd, maxlfd;
++ int sock, dofork, inetf, usechroot, nocgi, dogpcompat, errno_save,
++ nbindips, i, j, nlfdret, *lfdret, listfd, maxlfd;
+ char *port, *base, clienth[NI_MAXHOST], clientp[NI_MAXSERV];
+ char *user, *group, **bindips, *ohost, *sport, *p;
+ struct passwd *us;
+@@ -419,8 +420,12 @@ main(int argc, char *argv[])
+ inetf = AF_UNSPEC;
+ usechroot = 0;
+ nocgi = 0;
++ dogpcompat = 0;
+
+ ARGBEGIN {
++ case '+':
++ dogpcompat = 1;
++ break;
+ case '4':
+ inetf = AF_INET;
+ break;
+@@ -703,7 +708,7 @@ main(int argc, char *argv[])
+ #endif /* __OpenBSD__ */
+
+ handlerequest(sock, base, ohost, sport, clienth,
+- clientp, nocgi);
++ clientp, nocgi, dogpcompat);
+
+ waitforpendingbytes(sock);
+