articles/gopher.md: update
This commit is contained in:
parent
44a778c25c
commit
1ef222d3e1
1 changed files with 56 additions and 3 deletions
|
@ -4,13 +4,66 @@ Gopher is an hypertext protocol, similar to [HTTP](http.md) but far more simpler
|
|||
Pages using the Gopher protocol are known as "Gopherholes". As of writing this, there are about 200~300 active gopherholes.
|
||||
|
||||
## Protocol
|
||||
TODO
|
||||
Compared to other protocols, like HTTP, Gopher is a simple text-based protocol, described in [RFC 1436](https://datatracker.ietf.org/doc/html/rfc1436).
|
||||
Gopher does not use encryption, but extensions to it add optional encryption, see below.
|
||||
|
||||
Gopher has the port 70 assigned to for its use, and the `gopher://` URI protocol. To request a document to a Gopher server,
|
||||
first a TCP connection is opened at port 70 and the called *selector* string is sent along with a CRLF (`\r\n`) at the end
|
||||
(servers may also accept a simple `\n`), then the server should reply with the requested document. The selector is the
|
||||
path of the document on the server. When no selector is specified (so only a CRLF is sent),
|
||||
a default selector is sent to the client, usually a menu (gophermap).
|
||||
|
||||
With just netcat, printf and a pipe we can have a minimal client as a proof of concept, like this:
|
||||
```sh
|
||||
printf '\n' | nc 'khzae.net' 70
|
||||
printf '\r\n' | nc 'khzae.net' 70
|
||||
```
|
||||
|
||||
## Accesing
|
||||
### Gophermap
|
||||
A Gopher menu (also called Gophermap) follows a basic format, lines with tab separated fields:
|
||||
```
|
||||
type text selector hostname port
|
||||
```
|
||||
Here is an example of a line describing a selector:
|
||||
| Type | Text | Selector | Hostname | Port |
|
||||
| :----: |-------------------|----------|--------------| :--: |
|
||||
| 1 | Bitreich Projects | /scm | bitreich.org | 70 |
|
||||
|
||||
The type field can be any of the following:
|
||||
| Type | Description |
|
||||
| :--: |-----------------------------------------------------|
|
||||
| 0 | File |
|
||||
| 1 | Directory |
|
||||
| 2 | CSO phonebook server (?) |
|
||||
| 3 | Error |
|
||||
| 4 | BinHex Machintosh (?) |
|
||||
| 5 | DOS binary |
|
||||
| 6 | uuencoded file |
|
||||
| 7 | Index-search server |
|
||||
| 8 | Text Telnet session |
|
||||
| 9 | Binary file (EOF when server closes the connection) |
|
||||
| + | Redundant server |
|
||||
| T | Telnet 3270 |
|
||||
| g | GIF image |
|
||||
| I | Image, file format unspecified. |
|
||||
|
||||
A relative link to a document in the same server:
|
||||
```
|
||||
1About /about khzae.net 70
|
||||
```
|
||||
|
||||
Paragraphs can be made with the `i` type:
|
||||
```
|
||||
i___[ News Aggregator ] Err bitreich.org 70
|
||||
```
|
||||
The selector (marked here with a placeholder "Err"), server address and port are ignored.
|
||||
|
||||
Finally, a gophermap must end in a `.` followed by a CRLF on its own line.
|
||||
|
||||
|
||||
## Protocol extensions
|
||||
TODO list extensions
|
||||
|
||||
## Accessing
|
||||
"Modern" web browsers are so advanced that can't bother implementing such a trivial protocol, so if you're using a web browser you
|
||||
can use a proxy like <https://gopher.floodgap.com/gopher/> that works over HTTP.
|
||||
But for the true experience, you want a text based browser with native support for Gopher such as [Lynx](https://lynx.invisible-island.net/)
|
||||
|
|
Loading…
Add table
Reference in a new issue