SMOLNET PORTAL home about changes
iUpdate CGI to the current state and restyle it. - geomyidae - A small C-based gopherd.	Err	bitreich.org	70
hgit clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/	URL:git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/	bitreich.org	70
1Log	/scm/geomyidae/log.gph	bitreich.org	70
1Files	/scm/geomyidae/files.gph	bitreich.org	70
1Refs	/scm/geomyidae/refs.gph	bitreich.org	70
1Tags	/scm/geomyidae/tag	bitreich.org	70
1README	/scm/geomyidae/file/README.gph	bitreich.org	70
1LICENSE	/scm/geomyidae/file/LICENSE.gph	bitreich.org	70
i---	Err	bitreich.org	70
1commit 7bb98e044757e47523468791f8f4040893c34342	/scm/geomyidae/commit/7bb98e044757e47523468791f8f4040893c34342.gph	bitreich.org	70
1parent 1f99de32eae25260f0596aad2c33780a239ba999	/scm/geomyidae/commit/1f99de32eae25260f0596aad2c33780a239ba999.gph	bitreich.org	70
hAuthor: Christoph Lohmann <20h@r-36.net>	URL:mailto:20h@r-36.net	bitreich.org	70
iDate:   Sat, 22 Jul 2023 18:07:39 +0200	Err	bitreich.org	70
i	Err	bitreich.org	70
iUpdate CGI to the current state and restyle it.	Err	bitreich.org	70
i	Err	bitreich.org	70
iDiffstat:	Err	bitreich.org	70
i  M CGI.md                              |      86 +++++++++++++++++++++----------	Err	bitreich.org	70
i	Err	bitreich.org	70
i1 file changed, 59 insertions(+), 27 deletions(-)	Err	bitreich.org	70
i---	Err	bitreich.org	70
1diff --git a/CGI.md b/CGI.md	/scm/geomyidae/file/CGI.md.gph	bitreich.org	70
i@@ -1,29 +1,37 @@	Err	bitreich.org	70
i-# INTRODUCTION TO CGI	Err	bitreich.org	70
i+# Introduction to CGI	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Geomyidae has  support for running  scripts on each request,  which will	Err	bitreich.org	70
i generate dynamic content.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-There are two modes: standard cgi  and dynamic cgi. (»CGI« as name was	Err	bitreich.org	70
i-just taken, because that's easier to compare to the web.)	Err	bitreich.org	70
i+There are three modes: standard cgi, dynamic cgi and http compatibility	Err	bitreich.org	70
i+mode. (»CGI« as name was just taken, because that's easier to compare	Err	bitreich.org	70
i+to the web.)	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## PERMISSIONS	Err	bitreich.org	70
i+## Permissions	Err	bitreich.org	70
i 	Err	bitreich.org	70
i The scripts are run using the permissions of geomyidae. It is advised to	Err	bitreich.org	70
i use the -g and -u options of geomyidae.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## BEFOREHAND	Err	bitreich.org	70
i+## Beforehand	Err	bitreich.org	70
i 	Err	bitreich.org	70
i In these examples C: is what the client sends and S: what the server is	Err	bitreich.org	70
i sending.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i+## Stdout/Stdin I/O of the Scripts	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## CALLING CONVENTION	Err	bitreich.org	70
i+All scripts called below, in TLS or Non-TLS mode, will get full access of	Err	bitreich.org	70
i+the socket of the connection, with the socket bound to stdin and stdout.	Err	bitreich.org	70
i+Geomyidae does not check for any connection duration. This allows to	Err	bitreich.org	70
i+create long-lasting streaming services, like radio or TV stations.	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+## Calling Convention	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Geomyidae will call the script like this:	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-        % $gopherroot/test.cgi $search $arguments $host $port	Err	bitreich.org	70
i+        % $gopherroot/test.cgi $search $arguments $host $port $traversal	Err	bitreich.org	70
i+                        $selector	Err	bitreich.org	70
i 	Err	bitreich.org	70
i When it is a plain request, the arguments will have these values:	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -32,6 +40,8 @@ When it is a plain request, the arguments will have these values:	Err	bitreich.org	70
i         -> $arguments = ""	Err	bitreich.org	70
i         -> $host = server host	Err	bitreich.org	70
i         -> $port = server port	Err	bitreich.org	70
i+        -> $traversal = ""	Err	bitreich.org	70
i+        -> $selector = "/test.cgi"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i If the request is for a type 7 search element, then the entered string by	Err	bitreich.org	70
i the user will be seen as following:	Err	bitreich.org	70
i@@ -41,25 +51,31 @@ the user will be seen as following:	Err	bitreich.org	70
i         -> $arguments = ""	Err	bitreich.org	70
i         -> $host = server host	Err	bitreich.org	70
i         -> $port = server port	Err	bitreich.org	70
i+        -> $traversal = ""	Err	bitreich.org	70
i+        -> $selector = "/test.cgi\tsearchterm"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i When you are trying to give your script some calling arguments, the syntax	Err	bitreich.org	70
i is:	Err	bitreich.org	70
i 	Err	bitreich.org	70
i         C: /test.cgi?hello	Err	bitreich.org	70
i         -> $search = ""	Err	bitreich.org	70
i-        -> $arguments = »hello«	Err	bitreich.org	70
i+        -> $arguments = "hello"	Err	bitreich.org	70
i         -> $host = server host	Err	bitreich.org	70
i         -> $port = server port	Err	bitreich.org	70
i+        -> $traversal = ""	Err	bitreich.org	70
i+        -> $selector = "/test.cgi?hello"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i If both ways of input are combined, the variables are set as following:	Err	bitreich.org	70
i 	Err	bitreich.org	70
i         C: /test.cgi?hello=world        searchterm        (Beware! A Tab!)	Err	bitreich.org	70
i-        -> $search = »searchterm«	Err	bitreich.org	70
i-        -> $arguments = »hello=world«	Err	bitreich.org	70
i+        -> $search = "searchterm"	Err	bitreich.org	70
i+        -> $arguments = "hello=world"	Err	bitreich.org	70
i         -> $host = server host	Err	bitreich.org	70
i         -> $port = server port	Err	bitreich.org	70
i+        -> $traversal = ""	Err	bitreich.org	70
i+        -> $selector = "/test.cgi?hello=world\tsearchterm"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## REST CALLING CONVENTION	Err	bitreich.org	70
i+## REST Calling Convention	Err	bitreich.org	70
i 	Err	bitreich.org	70
i There is a special mode in geomyidae to imitate REST calling abilities.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -68,20 +84,21 @@ the base and go up the path directories, until it reaches the first not	Err	bitreich.org	70
i existing directory.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i         C: /base/some/dir/that/does/not/exist?some-arguments        searchterm	Err	bitreich.org	70
i-        -> /base exists	Err	bitreich.org	70
i-        -> /some exists	Err	bitreich.org	70
i-        -> /dir does not exist	Err	bitreich.org	70
i+        -> base exists	Err	bitreich.org	70
i+        -> some exists	Err	bitreich.org	70
i+        -> dir does not exist	Err	bitreich.org	70
i         -> search for index.cgi or index.dcgi in /base/some	Err	bitreich.org	70
i-        -> if not found, display directory content	Err	bitreich.org	70
i         -> if found, call index.cgi or index.dcgi as follows:	Err	bitreich.org	70
i-                -> $search = »searchterm«	Err	bitreich.org	70
i-                -> $arguments = »/dir/that/does/not/exist?some-arguments«	Err	bitreich.org	70
i+                -> $search = "searchterm"	Err	bitreich.org	70
i+                -> $arguments = "some-arguments"	Err	bitreich.org	70
i                 -> $host = server host	Err	bitreich.org	70
i                 -> $port = server port	Err	bitreich.org	70
i+                -> $traversal = "/dir/that/does/not/exist"	Err	bitreich.org	70
i+                -> $selector = "/base/some/dir/that/does/not/exist?some-arguments\tsearchterm"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## STANDARD CGI	Err	bitreich.org	70
i+## Standard CGI	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-The file  extension »cgi« switches to  this mode, where the  output of	Err	bitreich.org	70
i+The file  extension "cgi" switches to  this mode, where the  output of	Err	bitreich.org	70
i the script is not interpreted at all  by the server and the script needs	Err	bitreich.org	70
i to send raw content.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -95,9 +112,9 @@ The client will receive:	Err	bitreich.org	70
i         S: Hello my friend.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## DYNAMIC CGI	Err	bitreich.org	70
i+## Dynamic CGI	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-For using  dynamic CGI, the  file needs to  end in »dcgi«,  which will	Err	bitreich.org	70
i+For using  dynamic CGI, the  file needs to  end in "dcgi",  which will	Err	bitreich.org	70
i switch on  the interpretation of the  returned lines by the  server. The	Err	bitreich.org	70
i interpreted for- mat is the same as in the .gph files.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -111,16 +128,31 @@ gopher menu item.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i         S: 1Some link        /somewhere        gopher.r-36.net        70	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-For outputting  large texts and  having minor hassles with  the content,	Err	bitreich.org	70
i-prepend »t« to every line beginning with »t« or all lines:	Err	bitreich.org	70
i+## HTTP Compatibility	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-        % cat filereader.dcgi	Err	bitreich.org	70
i-        #!/bin/sh	Err	bitreich.org	70
i-        cat bigfile.txt | sed 's,^t,&&,'	Err	bitreich.org	70
i+In case someone sends some HTTP request to geomyidae and other cases,	Err	bitreich.org	70
i+geomyidae will do this:	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+        C: GET /some/dir HTTP/1.1	Err	bitreich.org	70
i+        -> /GET does exist and is executable	Err	bitreich.org	70
i+        -> call GET as follows:	Err	bitreich.org	70
i+                -> $search = ""	Err	bitreich.org	70
i+                -> $arguments = ""	Err	bitreich.org	70
i+                -> $host = server host	Err	bitreich.org	70
i+                -> $port = server port	Err	bitreich.org	70
i+                -> $traversal = ""	Err	bitreich.org	70
i+                -> $selector = "GET /some/dir HTTP/1.1\r\n"	Err	bitreich.org	70
i+                   (full raw request by the client.)	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+This allows to serve HTTP next go gopher and get TLS for free. Other	Err	bitreich.org	70
i+HTTP-like protocols can be used over gopher in simple scripts, like the	Err	bitreich.org	70
i+icecast upload protocol.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-## ENVIRONMENT VARIABLES	Err	bitreich.org	70
i+## Environment Variables	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Please see the manpage geomyidae(8) for all variables and their content.	Err	bitreich.org	70
i+All states of the script execution environment and client request are	Err	bitreich.org	70
i+available.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Have fun!	Err	bitreich.org	70
.
Response: text/plain
Original URLgopher://bitreich.org/0/scm/geomyidae/commit/7bb98e044757...
Content-Typetext/plain; charset=utf-8