iUpdate CGI to markdown and update to current state. - 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 1375ce4688358eca4db5bd1f0309863a574d250e /scm/geomyidae/commit/1375ce4688358eca4db5bd1f0309863a574d250e.gph bitreich.org 70 1parent 3c94b78e68c271bca2c9304e38895747bf67e347 /scm/geomyidae/commit/3c94b78e68c271bca2c9304e38895747bf67e347.gph bitreich.org 70 hAuthor: Christoph Lohmann <20h@r-36.net> URL:mailto:20h@r-36.net bitreich.org 70 iDate: Tue, 16 Jun 2020 12:40:48 +0200 Err bitreich.org 70 i Err bitreich.org 70 iUpdate CGI to markdown and update to current state. Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i D CGI | 103 ------------------------------- Err bitreich.org 70 i A CGI.md | 108 +++++++++++++++++++++++++++++++ Err bitreich.org 70 i Err bitreich.org 70 i2 files changed, 108 insertions(+), 103 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/CGI b/CGI /scm/geomyidae/file/CGI.gph bitreich.org 70 i@@ -1,103 +0,0 @@ Err bitreich.org 70 i-INTRODUCTION Err bitreich.org 70 i- Err bitreich.org 70 i-Geomyidae has support for running scripts on each request, which will generate Err bitreich.org 70 i-dynamic content. Err bitreich.org 70 i- Err bitreich.org 70 i-There are two modes: standard cgi and dynamic cgi. Err bitreich.org 70 i-(»CGI« as name was just taken, because that's easier to compare to the web.) Err bitreich.org 70 i- Err bitreich.org 70 i- 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 use Err bitreich.org 70 i-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- 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- 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- 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- C: /test.cgi 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- 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- Err bitreich.org 70 i- C: /test.cgi searchterm (There is a TAB in-between) Err bitreich.org 70 i- -> $search = »searchterm« 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- 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- -> $host = server host Err bitreich.org 70 i- -> $port = server port 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- -> $host = server host Err bitreich.org 70 i- -> $port = server port Err bitreich.org 70 i- Err bitreich.org 70 i- 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 the Err bitreich.org 70 i-script is not interpreted at all by the server and the script needs to send Err bitreich.org 70 i-raw content. Err bitreich.org 70 i- Err bitreich.org 70 i- % cat test.cgi Err bitreich.org 70 i- #!/bin/sh Err bitreich.org 70 i- echo "Hello my friend." Err bitreich.org 70 i- % Err bitreich.org 70 i- Err bitreich.org 70 i-The client will receive: Err bitreich.org 70 i- 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- Err bitreich.org 70 i-For using dynamic CGI, the file needs to end in »dcgi«, which will switch on Err bitreich.org 70 i-the interpretation of the returned lines by the server. The interpreted for- Err bitreich.org 70 i-mat is the same as in the *.gph files. Err bitreich.org 70 i- Err bitreich.org 70 i- % cat test.dcgi Err bitreich.org 70 i- #!/bin/sh Err bitreich.org 70 i- echo "[1|Some link|/somewhere|server|port]" Err bitreich.org 70 i- % Err bitreich.org 70 i- Err bitreich.org 70 i-Here geomyidae will interpret the *.gph format and return the valid gopher Err bitreich.org 70 i-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, prepend Err bitreich.org 70 i-»t« to every line beginning with »t« or all lines: 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- Err bitreich.org 70 i-Have fun! 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@@ -0,0 +1,108 @@ 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+ Err bitreich.org 70 i+ 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+ 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+ 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+ 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+ C: /test.cgi 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+ 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+ Err bitreich.org 70 i+ C: /test.cgi searchterm (There is a TAB in-between) Err bitreich.org 70 i+ -> $search = »searchterm« 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+ 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+ -> $host = server host Err bitreich.org 70 i+ -> $port = server port 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+ -> $host = server host Err bitreich.org 70 i+ -> $port = server port Err bitreich.org 70 i+ Err bitreich.org 70 i+ 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 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+ % cat test.cgi Err bitreich.org 70 i+ #!/bin/sh Err bitreich.org 70 i+ echo "Hello my friend." Err bitreich.org 70 i+ % Err bitreich.org 70 i+ Err bitreich.org 70 i+The client will receive: Err bitreich.org 70 i+ 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+ 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+ % cat test.dcgi Err bitreich.org 70 i+ #!/bin/sh Err bitreich.org 70 i+ echo "[1|Some link|/somewhere|server|port]" Err bitreich.org 70 i+ % Err bitreich.org 70 i+ Err bitreich.org 70 i+Here geomyidae will interpret the .gph format and return the valid Err bitreich.org 70 i+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+ 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+ 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+ Err bitreich.org 70 i+ Err bitreich.org 70 i+Have fun! Err bitreich.org 70 i+ Err bitreich.org 70 .