Skip to content

fmount/c_gopherd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A pure gopherd server implementation

This is a simple, minimal implementation of a Gopher server written in pure C that follow the reference:

It's supposed to simply serve the content you specify defining a root directory in the defaults.def.h file.

Build from SRC

You can simply build it using the provided Makefile.
According to the defined $PREFIX, the default all target generates a bin/ directory containing the result of the compilation.
The config target is useful to generate a lib/defaults.h with all the user-defined parameters.
For example, GROOT is the definition of the path that provides the content that should be served by this server: customize that value before building the project and make sure it's a valid path containing the gophermap and all the other resources to be exposed.
Before building the server, take some time to review the content of lib/defaults.def.h and customize the provided values.

$ make help

will show all the available targets.

$ make config

will generate the defaults.h according to the defaults.def.h

$ make

will compile and put the result in $(PREFIX) dir.

USAGE

$ ./c_gopherd -h
Usage ./bin/c_gopherd [-h host] [-p port] [-v]

THE GOPHER PROTOCOL AND DATA TYPES

In the /example folder there is a little Gophermap file.
By customizing the GOPHER_ROOT directory (aka GROOT) you can serve it as an HTML equivalent index.
In this way you can display your custom Gopher menu instead of just a directory listing.
A good approach enabled by the use of the gophermap is represented by the ability to create nested gopherholes indexed with their own gophermap in a structure like the following:

example/
  gophermap
  user1/
    gophermap
    user_1_content/
  user2
    gophermap
    user_2_content/
  content1/
  content2.txt
  ...
  ...

How the gophermap is built?

According to the rfc and the evolution of the protocol, the following table specifies the format and the content types allowed.
The technical specification for Gopher, RFC 1436, defines 14 item types. A one-character code indicates what kind of content the client should expect.
Item type 3 is an error code for exception handling. Gopher client authors improvised item types h (HTML), i (informational message), and s (sound file) after the publication of RFC 1436, and I think the informational message is very useful to organize better a gophermap and present the resources in a cleaner way.

Type Description
0 text file
1 Gopher submenu
2 CCSO Nameserver
3 Error code returned by a Gopher server to indicate failure
4 BinHex-encoded file (primarily for Macintosh computers)
5 DOS Files
6 uuencoded file
7 Gopher full-text search
8 Telnet
9 Binary file
+ Mirror or alternate server (for load balancing or in case of primary server downtime)
g GIF file
I Image file
T Telnet 3270
i informational message
h HTML file
s Sound file

An example of gophermap can be found here.

TODO LIST

Here the todo list containing the list of the next features we MUST have.

About

A pure C gopher server implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published