• Reading Search Queries in Gophernicus

    From freet@freet@aussies.space (The Free Thinker) to tilde.gopher on Sat Aug 29 02:56:33 2020
    I've figured out how search query strings are passed to scripts in
    Gophernicus, after being confused about it earlier, thinking they
    would be passed as command arguments.

    On a second look, I discovered the setenv_cgi function in file.c,
    and this sets a range of interesting environment variables for use
    by scripts (such as any gophermap file that is executable),
    including $QUERY_STRING and $SEARCHREQUEST which both contain the
    search string.

    Now I can finally get back to setting up a Gopher currency
    converter, when I find the time.

    Some other interesting environment variables that are set (many with
    similar or duplicate content):

    SERVER_SOFTWARE
    SERVER_ARCH
    SERVER_DESCRIPTION
    SERVER_VERSION
    SERVER_NAME
    SERVER_PORT
    SERVER_TLS_PORT
    DOCUMENT_ROOT
    SCRIPT_NAME
    SCRIPT_FILENAME
    LOCAL_ADDR
    REMOTE_ADDR
    HTTP_REFERER
    GOPHER_FILETYPE
    GOPHER_CHARSET
    GOPHER_REFERER
    COLUMNS
    SERVER_CODENAME
    SELECTOR
    SERVER_HOST
    REQUEST

    --

    - The Free Thinker | gopher://aussies.space/1/%7efreet/
    --- Synchronet 3.18b-Linux NewsLink 1.113
  • From yeti@yeti@tilde.institute to tilde.gopher on Sun Aug 30 05:41:45 2020
    freet@aussies.space (The Free Thinker) writes:

    SERVER_SOFTWARE
    SERVER_ARCH
    (((...)))
    SERVER_HOST
    REQUEST

    Is there some standard about which environment variables a gopher server ™should™ present to the CGIs or executable gophermaps?
    --- Synchronet 3.18b-Linux NewsLink 1.113
  • From freet@freet@aussies.space (The Free Thinker) to tilde.gopher on Sun Aug 30 23:02:26 2020
    yeti <yeti@tilde.institute> wrote:
    freet@aussies.space (The Free Thinker) writes:

    SERVER_SOFTWARE
    SERVER_ARCH
    (((...)))
    SERVER_HOST
    REQUEST

    Is there some standard about which environment variables a gopher server (TM)should(TM) present to the CGIs or executable gophermaps?

    The CGI standard introduces itself as specifically for HTTP servers: https://tools.ietf.org/html/rfc3875

    I'd be surprised if anyone has written an official Gopher CGI
    standard.

    the HTTP_REFERER and those after it in my list (if I didn't mess up
    the order) are noted in the Gophernicus source code as being special
    to Gophernicus, so unlikely to have followed any Gopher-specific
    standard. But there are more variables that I didn't list which just
    return fixed values for compatibility with CGI, so it's trying to be
    a "CGI compatible" implementation.

    --

    - The Free Thinker | gopher://aussies.space/1/%7efreet/
    --- Synchronet 3.18b-Linux NewsLink 1.113
  • From met@met@ph.or to tilde.gopher on Sat Feb 6 16:44:11 2021
    ..
    Is there some standard about which environment variables a gopher server
    (TM)should(TM) present to the CGIs or executable gophermaps?

    The CGI standard introduces itself as specifically for HTTP servers: >https://tools.ietf.org/html/rfc3875

    I'd be surprised if anyone has written an official Gopher CGI
    standard.

    Yeah, I basically just figured it out by trial and error. The common WWW standards can be put into a test gopher CGI to see what the generate, like
    this page:

    gopher://sdf.org/0/users/tdc/cgi-bin/gophernicus_cgi.sh?fubar

    There's some application shown in the 'Gopher Hacks' section:

    gopher://sdf.org/1/users/tdc/ghacks
    --- Synchronet 3.18b-Linux NewsLink 1.113