167 lines
5.9 KiB
Markdown
167 lines
5.9 KiB
Markdown
|
# Features
|
||
|
|
||
|
- Serve `DIR/gophermap` by default, else falls back to directory listing
|
||
|
|
||
|
- Parsing of any files named `gophermap` or ending in `.gophermap` as
|
||
|
gophermaps
|
||
|
|
||
|
- Automatic replacement of `$hostname` or `$port` in gophermap lines with
|
||
|
current host information
|
||
|
|
||
|
- Insert files with automated line reflowing, output of any CGI scripts
|
||
|
WITHIN gophermaps
|
||
|
|
||
|
- Support for all commonly accepted item type characters (beyond just
|
||
|
RFC1436 support)
|
||
|
|
||
|
- User supplied footer text appended to gophermaps and directory listings
|
||
|
|
||
|
## Gophermap Parsing
|
||
|
|
||
|
Due to the way that gophermap parsing is handled, if a gophermap is larger than
|
||
|
the max cache'd file size, these gophermaps WILL NOT be parsed by the server.
|
||
|
The features you will miss out on for these files are features listed
|
||
|
`[SERVER ONLY]` in the gophermap item types section below.
|
||
|
|
||
|
# Supported gophermap item types
|
||
|
|
||
|
All of the following item types are supported by Gophor, separated into
|
||
|
grouped standards. Most handling of item types is performed by the clients
|
||
|
connecting to Gophor, but when performing directory listings Gophor will
|
||
|
attempt to automatically classify files according to the below types.
|
||
|
|
||
|
Item types listed as `[SERVER ONLY]` means that these are item types
|
||
|
recognised ONLY by Gophor and to be used when crafting a gophermap. They
|
||
|
provide additional methods of formatting / functionality within a gophermap,
|
||
|
and the output of these item types is usually converted to informational
|
||
|
text lines before sending to connecting clients.
|
||
|
|
||
|
```
|
||
|
RFC 1436 Standard:
|
||
|
Type | Treat as | Meaning
|
||
|
--------------------------
|
||
|
0 | TEXT | Regular file (text)
|
||
|
1 | MENU | Directory (menu)
|
||
|
2 | EXTERNAL | CCSO flat db; other db
|
||
|
3 | ERROR | Error message
|
||
|
4 | TEXT | Macintosh BinHex file
|
||
|
5 | BINARY | Binary archive (zip, rar, 7zip, tar, gzip, etc)
|
||
|
6 | TEXT | UUEncoded archive
|
||
|
7 | INDEX | Query search engine or CGI script
|
||
|
8 | EXTERNAL | Telnet to: VT100 series server
|
||
|
9 | BINARY | Binary file (see also, 5)
|
||
|
T | EXTERNAL | Telnet to: tn3270 series server
|
||
|
g | BINARY | GIF format image file (just use I)
|
||
|
I | BINARY | Any format image file
|
||
|
+ | - | Redundant (indicates mirror of previous item)
|
||
|
. | - | Last line, stop processing gophermap
|
||
|
|
||
|
GopherII Standard:
|
||
|
Type | Treat as | Meaning
|
||
|
--------------------------
|
||
|
c | BINARY | Calendar file
|
||
|
d | BINARY | Word-processing document; PDF document
|
||
|
h | TEXT | HTML document
|
||
|
i | - | Informational text (not selectable)
|
||
|
p | TEXT | Page layout or markup document (plain text w/ ASCII tags)
|
||
|
m | BINARY | Email repository (MBOX)
|
||
|
s | BINARY | Audio recordings
|
||
|
x | TEXT | eXtensible Markup Language document
|
||
|
; | BINARY | Video files
|
||
|
|
||
|
Commonly used:
|
||
|
Type | Treat as | Meaning
|
||
|
--------------------------
|
||
|
! | - | [SERVER ONLY] Menu title (set title ONCE per gophermap)
|
||
|
# | - | [SERVER ONLY] Comment, rest of line is ignored
|
||
|
- | - | [SERVER ONLY] Hide file/directory from directory listing
|
||
|
* | - | [SERVER ONLY] Last line + directory listing -- stop processing
|
||
|
| | gophermap and end on a directory listing
|
||
|
= | - | [SERVER ONLY] Include or execute subgophermap, cgi-bin or regular
|
||
|
| | file here.
|
||
|
```
|
||
|
|
||
|
# Compliance
|
||
|
|
||
|
We aim to comply more with GopherII (see in references below).
|
||
|
|
||
|
## Item types
|
||
|
|
||
|
Supported item types are listed above.
|
||
|
|
||
|
Informational lines are sent as `i<text here>\t/\tnull.host\t0`.
|
||
|
|
||
|
Titles are sent as `i<title text>\tTITLE\tnull.host\t0`.
|
||
|
|
||
|
Web address links are sent as `h<text here>\tURL:<address>\thostname\tport`.
|
||
|
An HTML redirect is sent in response to any requests beginning with `URL:`.
|
||
|
|
||
|
## Policy files
|
||
|
|
||
|
Upon request, `caps.txt` can be provided from the server root directory
|
||
|
containing server capabiities. This can either be user or server generated.
|
||
|
|
||
|
Upon request, `robots.txt` can be provided from the server root directory
|
||
|
containing robot access restriction policies. This can either be user or
|
||
|
server generated.
|
||
|
|
||
|
## Errors
|
||
|
|
||
|
Errors are sent according to GopherII standards, terminating with a last
|
||
|
line:
|
||
|
`3<error text>CR-LF`
|
||
|
|
||
|
Possible Gophor errors:
|
||
|
```
|
||
|
Text | Meaning
|
||
|
400 Bad Request | Request not understood by server due to malformed
|
||
|
| syntax
|
||
|
401 Unauthorised | Request requires authentication
|
||
|
403 Forbidden | Request received but not fulfilled
|
||
|
404 Not Found | Server could not find anything matching requested
|
||
|
| URL
|
||
|
408 Request Time-out | Client did not produce request within server wait
|
||
|
| time
|
||
|
410 Gone | Requested resource no longer available with no
|
||
|
| forwarding address
|
||
|
500 Internal Server Error | Server encountered an unexpected condition which
|
||
|
| prevented request being fulfilled
|
||
|
501 Not Implemented | Server does not support the functionality
|
||
|
| required to fulfil the request
|
||
|
503 Service Unavailable | Server currently unable to handle the request
|
||
|
| due to temporary overload / maintenance
|
||
|
```
|
||
|
|
||
|
## Terminating full stop
|
||
|
|
||
|
Gophor will send a terminating full-stop for menus, but not for served
|
||
|
or executed files.
|
||
|
|
||
|
## Placeholder (null) text
|
||
|
|
||
|
All of the following are used as placeholder text in responses...
|
||
|
|
||
|
Null selector: `-`
|
||
|
|
||
|
Null host: `null.host`
|
||
|
|
||
|
Null port: `0`
|
||
|
|
||
|
# Resources used
|
||
|
|
||
|
Gopher-II (The Next Generation Gopher WWIS):
|
||
|
https://tools.ietf.org/html/draft-matavka-gopher-ii-00
|
||
|
|
||
|
Gophernicus source (a great gopher daemon in C):
|
||
|
https://github.com/gophernicus/gophernicus
|
||
|
|
||
|
All of the below can be viewed from your standard web browser using
|
||
|
floodgap's Gopher proxy:
|
||
|
https://gopher.floodgap.com/gopher/gw
|
||
|
|
||
|
RFC 1436 (The Internet Gopher Protocol:
|
||
|
`gopher://gopher.floodgap.com:70/0/gopher/tech/rfc1436.txt`
|
||
|
|
||
|
Gopher+ (upward compatible enhancements):
|
||
|
`gopher://gopher.floodgap.com:70/0/gopher/tech/gopherplus.txt`
|