Screenshots
Comanche Source Code
 previous   up   next 

Comanche is a simple web server for static HTML pages and CGI programs. The Comanche web server is named after the Native American ethnic group which drove the Apaches from the Southern Plains after 1650.

Rationale

Comanche is intended as test tool for HTML pages and CGI programs. CGI Programs written in Seed7 can be tested easily. Comanche does not require any installation, configuration files or superuser/administrator privileges.

Usage

Comanche can be called from a command window with:

comanche [-h | -?] [-p port] [-c cgi-name] [-tls] [html-dir [cgi-dir [env-file]]]

Options:

-h or -?    Write usage information.
-p port    Specify the port (default: 1080).
-c cgi-name    Specify the cgi-name used in the HTTP(S) requests (default: /cgi-bin/). If cgi-name is "" the cgi-name is taken from cgi-dir.
-tls    Use HTTPS instead of HTTP.

Parameters:

html-dir    The root directory for HTML files (default: ../htdocs).
cgi-dir    The root directory for CGI scripts (default: ../prg).
env-file    Property file with environment variables to be defined.

Example of a comanche usage:

s7 comanche

When comanche is started, it writes some information about its parameters:

SEED7 INTERPRETER Version 5.1.782  Copyright (c) 1990-2023 Thomas Mertes
Comanche Version 2.0 - Simple webserver for static and cgi pages
Copyright (C) 2009 - 2017, 2023 Thomas Mertes
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comanche is written in the Seed7 programming language
Homepage: http://seed7.sourceforge.net
HTML directory: /disk2_460GiB/home/tm/seed7_5/htdocs
CGI directory: /disk2_460GiB/home/tm/seed7_5/prg
CGI name: /cgi-bin/
Port: 1080
To test comanche make sure that "/disk2_460GiB/home/tm/seed7_5/htdocs/index.htm" exists and
open http://localhost:1080/ in your browser. To stop comanche press CTRL-C.

If the file "../htdocs/index.htm" exists, you can open it with http://localhost:1080/ in your browser. The CGI program "../prg/cgiExample" can be opened with http://localhost:1080/cgi-bin/cgiExample in your browser.

To stop comanche press CTRL-C. Comanche responds with

*** SIGNAL INTR RAISED

*** Program terminated.

Operation method

Comanche works for files with the .html or .htm extension. The content type of the HTTP response is determined by the extension of the requested file or by a magic number at the beginning of the file. CGI scripts written in Seed7 (extension *.sd7) are executed with the Seed7 interpreter (s7).

Download

Comanche is written in the Seed7 programming language and can be downloaded as part of the Seed7 package. To use comanche it is necessary to compile the Seed7 interpreter. Afterwards Comanche can be started from the directory 'seed7/prg' with:

s7 comanche

Comanche can be compiled with:

s7c comanche

This creates an executable which can be used without the 's7' interpreter.


Starting Comanche

Comanche serving the Seed7 homepage

Comanche returning "404 Not Found"

 previous   up   next