HIBACHI/2.0 Web Server
Version 3.0.4

[hih-BAH-chee]

Japanese for "fire bowl", a hibachi is just that - a small (generally cast-iron) container made for holding fuel (usually charcoal). A grill that sits on top of the bowl is used to cook various foods. Hibachis come in square, oblong and round models. Because of their compact size, they're completely portable.

- epicurious.com food dictionary

Description

This is Hibachi. A simple, small, and secure web server with virtual host and Common Gateway Interface support. It is a limited implementation of RFC 2616 HTTP/1.1.

Hibachi supports dynamic web content through the use of RFC 3875 Common Gateway Interface 1.1 specification. Just about any scripting or programming language can be used, such as a POSIX shell, Perl, PHP, Python, and/or Ruby. Existing CGI scripts can be used with little or no modification. Hibachi executes all CGI scripts as though they were "nph" prefixed, which is to say that it is the script's responsibility to send the HTTP status line and necessary headers direct to the client.

Virtual host support is implemented as subdirectories of the Hibachi server root, where the directory name is the domain name publish in a URL. For example to setup a virtual host by name or IP for http://www.snert.com/, assuming the Hibachi server root is /var/hibachi/sites/, then:

/var/hibachi/sites/
	www.snert.com/
		index.html
		...
	www.snert.org -> www.snert.com
	www.snert.net -> www.snert.com
	192.0.2.9     -> www.snert.com

Hibachi is ideal for special floppy Linux or BSD distributions, which can be used for rescue, firewall, demo, or dedicated servers. Hibachi combined with a script interpreter, like PHP, could also be bundled with CDROMS that require a means of presenting dynamic web pages. Hibachi is currently used by Tick Cafe 3, an Internet Cafe time management system.

History

Hibachi 1.0 was a winning entry in the International Obfuscated C Code Contest 2004. It used a process forking model and worked only with Unix variants and the Cygwin environment for Windows.

Hibachi 2.0 switched to use threading and improved CGI/1.1 support. It ran on any Unix, Cygwin, or as a native Windows service. There was an experimental process fork version for Minix that was never released to the public.

Hibachi 3.0 uses a pre-spawned pool of server threads for increased performance, has a new option syntax similar to SnertSoft's other offerings, and supports IPv4 and IPv6. Like its predecessor it runs on Unix, Cygwin, or as a native Windows service.

Features

  • Supports virtual hosts, with an optional default host.
  • Supports .asis files and custom error documents (400, 404, 500, 501).
  • Supports RFC 3875 Common Gateway Interface 1.1 scripts and programs.
  • Supports multiple index.* file types, ie. index.html, index.cgi, index.php, index.pl, index.asis, ...
  • Supports a subset of RFC 2616 HTTP/1.1 methods: GET, HEAD, and POST.
  • Simple & straight forward configuration using command line options.
  • Known to work with Chrome, Firefox, Lynx, Opera, and Internet Explorer web browsers.
  • Uses POSIX or Windows threads.
  • Tested on Cygwin, FreeBSD, Linux, OpenBSD, and Windows.
  • Can be run as a Unix daemon or Windows service.
  • Is secure against relative path file snooping.
  • Is secure against directory searches.
  • And has a really cool animated logo too.

Option Syntax

hibachi [options]

Options can be expressed in four different ways. Boolean options are expressed as +option or -option to turn the option on or off respectively. Numeric, string, and list options are expressed as option=value to set the option or option+=value to append to a list. Note that the +option and -option syntax are equivalent to option=1 and option=0 respectively. String values containing white space must be quoted using single (') or double (") quotes. Option names are case insensitive.

Some options, like +help or -help, are treated as immediate actions or commands. Unknown options are ignored and not reported. The first command-line argument is that which does not adhere to the above option syntax. The special command-line argument -- can be used to explicitly signal an end to the list of options.

The default options, as shown below, can be altered by specifying them on the command-line or within an option file, which simply contains command-line options one or more per line and/or on multiple lines. Comments are allowed and are denoted by a line starting with a hash (#) character. If the file option is defined and not empty, then it is parsed first, followed by the command line options.

Option names that start with a leading underscore (_) are considered experimental and subject to change or be removed from future builds. They should not normally be used on production systems.

A default options file can be created using -help:

hibachi -help >/etc/hibachi.cf

or

hibachi help=./hibachi.cf

Option Summary

+daemon
Start as a background daemon or foreground application.
dns-max-timeout=45
Maximum timeout in seconds for a DNS query.
-dns-round-robin
Set true to query NS servers in round robin order. Set false to query all the NS servers in parallel.
file=/etc/hibachi/hibachi.cf
Read option file before command line options.
-help, +help, help=filepath
Write the option summary to standard output or a file and exit. The output is suitable for use as an option file. When the option is assigned a file path string, the output will be to saved the given file path, eg. help=C:/hibachi/hibachi.cf
-info, +info
Show version and build information.
interfaces="[::0]:8008; 0.0.0.0:8008"
A semi-colon separared list of interface host names or IP addresses on which to bind and listen for new connections. They can be IPv4 and/or IPv6.
mime-types=".htm, text/html"
mime-types+=".html, text/html"
mime-types+=".jpg, image/jpeg"
mime-types+=".jpeg, image/jpeg"
mime-types+=".gif, image/gif"
mime-types+=".png, image/png"
mime-types+=".txt, text/plain"
mime-types+=".css, text/css"
mime-types+=".js, text/javascript"
mime-types+=".zip, application/x-zip-compressed"
mime-types+=".rar, application/x-rar-compressed"
A semi-colon separated list of file-extension and mime-type pairs. Each file-extension and mime type pair is comma and/or space separated. Unknown extensions will default to application/octet-stream.
-quit, +quit
Quit an already running instance and exit.
-restart, +restart
Terminate an already running instance before starting.
-restart-if, +restart-if
Only restart when there is a currently running instance.
run-group=hibachi
Run as this Unix group.
-run-jailed
Run in a chroot jail; run-work-dir used as the new root directory.
run-pid-file=/var/run/hibachi.pid
The file path of where to save the process-id.
run-user=hibachi
Run as this Unix user.
run-work-dir=/var/tmp
The working directory of the process.
server-accept-timeout=10000
Time in milliseconds a server thread waits for a new connection, before possibly terminating excess threads.
server-max-threads=0
Maximum number of server threads possible to handle new requests. Specify zero to allow upto the system thread limit.
server-min-threads=10
Minimum number of server threads to keep alive to handle new requests.
server-new-threads=10
Number of new server threads to create when all the existing threads are in use.
server-read-timeout=30000
Time in milliseconds the server waits for some input from the client.
-service, +service
Remove or add Windows service.
-test-mode
Used for testing. Run the server in single thread mode and accept client connections sequentionally ie. no concurrency possible.
verbose=warn,info
Verbose logging to mail log. Specify one or more comma separated words: content, debug, dns, environment, info, mutex, protocol, socket, timers, trace, warn
-version, +version
Show version and copyright.

Installation

  1. Download:

    hibachi Windows binary md5sum Change Log License
    hibachi source md5sum Change Log License
    LibSnert source md5sum Change Log License
  2. Depending on the OS platform:

    • Windows: Simply double-click on the installer to install the pre-built Windows native binaries and copy of this documentation.

    • Unix-like systems:

      tar -zxf hibachi-3.0.tar.gz
      tar -zxf libsnert-1.69.20.tar.gz
      cd com/snert/src/lib
      ./configure
      make build
      cd ../hibachi-3.0
      # Default install into /usr/local directories. See ./configure --help.
      ./configure --enable-root=/var/hibachi/sites
      make build
      sudo make install

Running (Unix)

To test and try out Hibachi:

cd hibachi-3.0
src/hibachi run-work-dir=.
lynx http://localhost:8008/

To stop the server:

src/hibachi -quit

To access this documentation and examples from the Internet, create symbolic links for the host name and/or IP pointing to the «localhost» directory. For example, replace the IP and host name addresses below with that of the machine running Hibachi:

ln -s localhost 192.0.2.1
ln -s localhost hibachi.snert.org

Hibachi can serve multiple web sites from the same machine simply by creating content directories with the same name as the URL domain names within the document root tree. Domain and/or IP aliases are simply symbolic links to content directories. Windows does not support symbolic links, so the domain or IP aliases can also be a simple text file containing the absolute path to another directory. There is never any need to restart Hibachi when web sites are published or aliases added. Assuming the server is running and that port 8008 is not blocked by any firewall, you should be able to access the server from the Internet using an IP or host name URL similar to:

http://192.0.2.1:8008/
http://hibachi.snert.org:8008/

Port 8008 (http-alt) was chosen as the default port for demonstration and testing purposes, since it is an alternative HTTP port that does not require special privileges and is rarely in use. Of course, Hibachi could be run as a standard web server on port 80, but this would require that it be installed by the system administrator. For example:

hibachi interfaces=0.0.0.0:80 run-user=www run-user=www
lynx http://localhost/

The user and group names specified above should be replaced by a suitable unprivileged user and group.

CGI Examples

The following tests and examples are available to demonstrate various aspects of the CGI support:

C
The first example is a simple dump of a GET request. The second one is a similar test using a POST request. The last test, while not impressive on its own, it is handy for a web client behind a NAT firewall wanting to discover its public IP address. These C based tests are the only ones that work without modification for the Windows native version of Hibachi.

POSIX Shell
These CGI scripts perform some basic tests on the handling of GET and POST requests, cookies, and the passing of environment variables to CGI scripts. These CGI scripts assume that /bin/sh is a POSIX compliant shell and the standard set of POSIX utilities are available. Should work for all Unix variants and Cygwin.

Perl
Powered by Perl This example queries the Yahoo web site for a stock quote to insert into a web page. This example requires a browser with JavaScript support and should work for all Unix variants and Cygwin, when Perl is installed.

PHP
Powered by PHP This PHP example generates a calendar complete with ISO 8601:2000 week numbers. The Windows native PHP 5 manual installation works very nicely now. The file:
test/php/php.ini.win.patch
shows the recommended Windows settings for PHP, assuming its installed in C:/php. Be sure to select the extensions you desire.

Ruby
This example validates and/or generates Luhn check-digits. Should work for all Unix variants and Cygwin, when Ruby is installed.

Portability

FreeBSD     4.8+
Linux Linux 2.0+
OpenBSD 3.6+
Sun Microsystems Logo
5.8+
Cygwin Unix Emulation Microsoft Windows Windows 2000 SP4, Windows XP Pro SP2
To build requires Cygwin, gcc, mingw.

License Agreement 1.7

SNERTSOFT & CO. ARE WILLING TO LICENSE THE SOFTWARE IDENTIFIED ABOVE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. PLEASE READ THE AGREEMENT CAREFULLY. BY DOWNLOADING OR INSTALLING THIS SOFTWARE, YOU ACCEPT THE TERMS OF THE AGREEMENT.

  1. Definitions

    1. ``Package'' means the identified above in source and/or binary form, any other machine readable materials provided (including, but not limited to documentation, sample files, data files), any updates or error corrections, and its derivative works.

    2. ``Organisation'' means a legal entity or an individual.

    3. ``You'' (or ``Your'') means an Organisation exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, ``You'' includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition,``control'' means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.

    4. ``SnertSoft'' means Anthony C. Howe situated in Cannes, France (SIRET #489 259 937 00014).

    5. ``SnertSoft & Co.'' means SnertSoft and all authorised & licensed partners, such as value-added resellers or appliance manufacturers.

  2. Statement of Original Work

    1. The Package is an original work written by SnertSoft, with exception of following third party code:

      1. MD5 routines written by L. Peter Deutsch, based on RFC 1321;

      2. SQLite3 package is written by D. Richard Hipp of Hwaci and is in the public domain.

      3. strnatcmp.c is written by Martin Pool of sourcefrog.net and has a BSD style license.

  3. License To Use

    1. You may install and use this Package, without modifications, exclusively on machines for which You have purchased a license, provided You retain this notice, SnertSoft's copyright notice, any and all license control methods (see below), and any links within the Package back to the most current online versions of this License and Disclaimer.

    2. You may copy, share, distribute, modify, and create derivative works from the user manuals and any related documentation solely for Your internal business purposes, such as in-house documentation, training manuals, or reference material.

  4. Restrictions

    1. Redistribution, including but not limited to books, CDROMS, download mirrors, floppy diskettes, hard disks, hardcopy print outs, online archives, solid state disks, streaming tapes, or other current or future forms of storage or communication media of the Package, with or without modifications, including any and all derivative works such as source patches, binaries, binary patches, or similar is expressly forbidden without prior written permission in hardcopy (ie. letter or fax) signed and dated by SnertSoft.

    2. It is expressly forbidden for You to use the Package, in whole or in part, in any other software or appliance without prior written permission in hardcopy (ie. letter or fax) signed and dated by SnertSoft.

    3. It is expressly forbidden for You to use the Package to develop any software or other technology having the same primary function as the Package, including but not limited to using the Package in any development or test procedure that seeks to develop like software or other technology, or determine if such software or other technology performs in a similar manner as the Package.

    4. You may not sell, rent, lease, or transfer the Package to third parties without prior written permission in hardcopy (ie. letter or fax) signed and dated by SnertSoft.

  5. Termination

    1. This Agreement is effective until terminated. You may terminate this Agreement at any time by destroying all copies of the Package.

    2. This Agreement will terminate immediately without notice from SnertSoft if You fail to comply with any provision of this Agreement.

    3. Either party may terminate this Agreement immediately should any portion of the Package become, or in either party's opinion be likely to become, the subject of a claim of infringement of any intellectual property right. Upon Termination, You must destroy all copies of the Package.

  6. Versions Of The License

    1. New Versions. SnertSoft may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.

    2. Effect of New Versions. Once a version of the Package has been published under a particular version of the License, You may always continue to use it under the terms of that License version. You may also choose to use such Package under the terms of the most current version of the License published by SnertSoft.

    3. No one other than SnertSoft has the right to modify the terms applicable to the Package created under this License.

Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO WAY SHALL SNERTSOFT OR LICENSEE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License Control

The Package may use one or more license control methods including, but not limited to, license key activation, periodic reporting of Package details and IP address of installation to SnertSoft & Co., or remote license verification by SnertSoft & Co.. Any information reported to or gathered by SnertSoft & Co. shall remain strictly confidential and the private property of SnertSoft & Co.. Under no circumstances will SnertSoft & Co. resell or release this information to third parties, unless demanded by court order.

Support

Support is provided for one year from date of purchase and only for SnertSoft's original Package that was purchased directly from SnertSoft. Additional support beyond the first year can be obtained from SnertSoft on time & materials basis or from one of SnertSoft's authorised partners.

Support for the Package obtained from authorised partners, such as value-added resllers or appliance manufacturers, will be supplied by those partners. SnertSoft will not support the Package without proof of purchase from SnertSoft, such as an Order N° or Invoice N°.

Package enhancements requests and product suggestions are always welcome. A community mailing list is available; please refer to SnertSoft web site Support area for details.

- TOP -

Powered by Hibachi