Small HTTP server



If server works it's avilable:

Setting / Current state
Users & Virtual Hosts
Current statistics
What's new?
(Last version, Forum, etc.)
Upload Web Mail
An external script gives Web intrface for working with mail

What's this?

This very small utility turns your computer into a fully functional Web-server. The program itself requires a minimal set of system resources, so the server's functioning doesn't influence your computer's performance. This server can function under a LAN networking or even under a Dial-Up networking. Webmasters can run this utility on their local computers and debug their CGI-scripts without going on-line.

This is probably the smallest HTTP server, but you shouldn't underestimate its capabilities.



Compactness is one of the greatest features of this product. Its functioning doesn't obstruct your work. This server uses a minimal set of system resources necessary for a quick data transfer and releases them immediately after the transfer has been made. Certainly, I had to limit the program's capabilities in order to provide its effective work.


  • The number of processes treated simultaneously cannot exceed the number specified during settings or launching the program Although, it is well enough for an average web site attracting up to 3000 visitors a day.
  • Only GET, POST and HEAD methods available.
  • DNS server is simple. Redirect does not supported. Zone exchange and some other request does not supported. Mailhost always same as host.


    How to...?

    Well, it is fairly easy - setup it by running shttp3.exe. Select target folder, check "Update entry in main menu", enter user name and password for administration. Press "Install." After installation, run "Small HTTP server" and go to Setting / Current state to option your server.
    You can go to your web server from local PC use If you don't have DNS name, that's not a big problem. Any user can go to your web site by entering your IP address. You can also add your site to search engines applying the IP address as the URL.

    Directories and files names.

    The server works with certain directories and files names. Your site is supposed to be in the directory specified during settings (WWW by default). Only files in this folder and its sub-folders (except CGI-BIN) can be retrieved. CGI-BIN is supposed to contain executable CGI-scripts, so when the server receives a request for a file in CGI-BIN, it tries to execute it. If the requested file ends in .pl, the PERL interpreter is called. If the requested file ends in .phtml, .pht, .php, the PHP interpreter runs this file. For example, if you installed the server in c:\http, then files in c:\http\www can be accessed, i.e. a user types http://Your_IP_address_here/test.html, he or she will see c:\http\www\test.html file. CGI scripts are in C:\HTTP\WWW\CGI-BIN. If you create IMAGES sub-folder in WWW folder and put bgr.gif there, it can be accessed by http://Your_IP_address/IMAGES/bgr.gif. Anyway, if the file name is not specified, i.e. the request ends in '/', the server will show the default file which name was specified either during setting. For instance, is equal to

    ASIS files also support. Those files content HTTP header in the beginning. Such files are being used for redirect inbound request to other site. This file must begins with keyword "Status: " after this returning code and your header is going. After header one line is empty, and data. Extension must be .asi or .asis


    Options and command line parameters.

    You can option server via dialog box "Settings..", via Web interface if remote administration is enabled, or you can manual edit http.cfg or just add parameters to command line. In many case you don't need to change settings manually but if you really want to, you can do with next keys.
    Parametr and commentKey
    General Setting
    Disable icon in taskbar. Don't add icon into systrey (server's window always in back). In this case to get access to administration dialog box you must: To get server window you can press Ctrl-Alt-Del to open task manager, in task manager select Http, and try to kill it. Server will ask you "Do you want to close HTTP server?" , -- If you reply "No" server show window. In server window's select system menu (Right button on title) and select advanced item "Server"noicon
    Minimize on startup.hide
    Detail log for POP/SMTP/FTP. Otherwise only basic event are added to log.detail
    Disable saving log.nolog
    Store log. Log file name to save.log=name.log
    New log file every new day. Server will every day rename old log file (add date to name). It's necessary to get statistics for a day.logday
    Enable to remote administration. Otherwise, only statistics will be available for administrators.radmin
    Users from the same host. You can restrict number of simulate request from the same host. Usually one browser creates four simulate connections. Some browsers try to create much more simulate connections. This restriction includes all TCP connections (HTTP,FTP,POP,SMTP,Proxy)from_same_host=##
    HTTP server
    TCP/IP port for HTTP server. Usually it's 80port=##
    How many HTTP requests will be working in the same time. About 20Kb of memory will be reserved for each simulate thread. Usually 5-12 connections are enough for 3-8 visitors per minute. max=##
    Default file name. Name when requested URL finished by "/". You can use wildcard character '*'. E.g. index.* to direct any index file in foulder)def=name.ext
    Default web foulder.dir=root_dir_name
    CGI ident. It's a part of URL for identification CGI. By default it is "\cgi-bin\", but you can use e.g. "\cgi-", "\local-bin\", ".cgi", etc.cgi_ident="\cgi-bin\"
    PERL interpreter. Interpreter for scripts with .pl extensionperl=path\name.exe
    Share dir. If you want this dir to be CGI current dir always, direct it here. Otherwise CGI current dir will be CGI script dir.share=path
    Enable to checks Server Side Includes (SSI) in HTML files. By default server checks SSI in .sht*,.sml*,.asp* files only. Warning: It requests more memory, and work longerssihtm
    Key to check SSI in .sht*,.sml*,.asp* files only.nossihtm
    The limit of receiving by POST method in bytes. Don't direct big value because it's may preoccupy your PC and network.post_limit=##
    Never run .htm,.gif,.jpg files. Otherwise, server trays to run any file with CGI ident.norunhtm
    Limit of time for CGI execution. In seconds.cgi_timeout=##
    CGI interpreters
    Application or DLL which runs when specific CGI-file is requested. E.g. for .sh -- d:\gnu\bin\bash.exe, for .cgi -- d:\perl\perlis.dll.
    Mime types
    Define extended mime type for extension. E.g. for .bmp mime type may be image/bitmap
    Virtual hosts
    Web root dir for specific hostname. You may add many hosts with its own folder.
    Key may be repeated more then once.
    Proxy server
    Disable HTTP proxy.noproxy
    TCP/IP port for proxy server.proxy=#port
    How many proxy requests will be working in the same time.proxy_max=#max
    Cache size (Kb). It's memory cache size.cache=proxy_cach_size
    Least IP address that enabled to use proxy.proxy_ip_min=#.#.#.#
    Most IP address that enabled to use proxy.proxy_ip_max=#.#.#.#
    Disable to save cache in hard disk.noproxy_dir
    Cache proxy directory.proxy_dir=path
    For how many days files will be saved. Proxy can delete downloaded files from cache proxy directory after several days of last download. In any case, if user press "Reload" button files download again.proxy_time=#days
    DNS server
    Hosts file. See also format of this filehosts=hosts_file
    Disable DNS server.nodns
    To remote redirect server. Current IP notification
    URL on redirect server. Full URL to update your IP address on dinamic DNS server. "$IP_ADDRESS" to insert your real IP address into URL. ddns=url
    Time to re-confirm your IP on redirect server.ddns_time=#N
    Disable dynamic DNS.noddns
    FTP server
    Disable FTP servernoftp
    How many FTP requests will be working in the same time.ftp_max=max
    TCP/IP port for FTP server. Usually it is 21ftp_port=port
    Limit of user timeout in second. If user doing nothing during this time, connection will close.ftp_timeout=#N
    POP3 server setting
    Disable POP3 server.nopop3
    How many requests will be working in the same time.pop3_max=max
    TCP/IP port for POP3 server. Usually it is 110pop_port=port
    SMTP server setting
    Disable SMTP server.nosmtp
    How many requests will be working in the same time.smtp_max=max
    SMTP server name. (Domain name)
    Use all virtual hosts as alias domain name.vhalias
    TCP/IP port for SMTP server. Usually it's 25smtp_port=port
    Output path. Directory to store messages before sendsmtp_out=path
    Sent path. Directory to store messages after sentsmtp_sent=path
    Error path. Directory to store messages, that can't be sentsmtp_err=path
    DNS server to get mail routing info. (May be your default DNS server)smtp_dns=#.#.#.#
    Receive to send with any "From" field. Otherwise server will send message from user_name@your.domain.namesmtp_any
    SMTP range. Low user's IPsmtp_ip_min=#.#.#.#
    SMTP range. Height user's IPsmtp_ip_max=#.#.#.#
    Blacklist. E-mail addresses of spamers listed through space. (May be * to disable receiving from any address of this host) blacklist="u@adr1 *@adr2 ..."
    Enable to check "forward" file in user's directory and do instruction from it.forward
    Enable to execute applications from user's "forward" file. fwdrun
    To give FTP, Mail, Administration access you must add users.
    Key may be repeated more then once.
    type_of_access_flags -- It's sequence of next symbol:
    • F -- FTP access -- user can read files from his home directory and any subdirectory via FTP.
    • W -- FTP write access -- user can upload files to his home directory via FTP.
    • N -- Disable upload files via cgi-ident in path.
    • S -- SMTP. User can send messages via SMTP from
    • P -- POP3. User will have mailbox. All messages to will stored in home/mbox directory and available via POP3.
    • A -- This is administrator. -- He has full access to administration's pages, can add users, change access rights etc...
    For FTP access you can add anonymous user without password In this case just skip password. E.g.:

    Please note that there shouldn't be spaces before and after "=". If a parameter you are entering contains spaces make sure that you put them in quotes. Here is an example of a correct command line:
    http.exe port=1080 def=index.html php="C:\PROGRAM FILES\PHP\php.exe" nolog
    Here is an example of configuration file:
    perl=C:\PERL\BIN\perlis.dll # supported !!!
    max=12 def=index.stm
    @www.cfg # include other configuration file;C:\WWW1;C:\WWW2
    # End of file


    Running scripts.

    As mentioned earlier, scripts are placed in CGI-BIN. CGI/1.1 standards are supported, for reference please consult http://Web.Golux.Com/coar/cgi/. When running a script, request line parameters are transferred both in command line and in QUERY_STRING environment variable. The script transfers data directly to the client that requested it. A script should output Content-Type: type\r\n or Location: url. There could be some auxiliary lines like Content-Length: xx\r\n or Date:. These data end in \r\n\r\n. If you use C or Perl please note that in text mode output functions automatically transform \n to \r\n. Pascal writeln function also completes output with these symbols. (\r = [CR] = 0x0D; \n = [LF] = 0x0A )


    Server Side Includes (SSI)

  • SSI can greatly increase your capabilities allowing you to dynamically insert results of CGI scripts in any place of a document being shown to the user.
  • When a remote client requests a *.sht, *.shtm or *.shtml file, server returns it evaluating SSI tags which are contained there.
  • SSI tags have the following format:
    <!--#tag_name {variable="value" } -->
  • HTTP or request form variables can be put into the "value" field. Variable name starts with $ and can be later put in braces {} if you wish to concatenate the variable value with subsequent text (excepting spaces). For instance , $USER_AGENT contains browser type, and if you want to concatenate it with "_12345", use "${USER_AGENT}_12345". When using symbols like $, \, " make sure you place \ before them: $ - \$, \ - \\, " - \" etc. If a variable can't be evaluated, it replaced with the "undefined" value.

    Current server version supports the following tags:

    <!--#include virtual="path/file_name" -->
    <!--#include file="full_path/file_name" -->
    Both variants include the content of file_name in the document. In first case it looks for the document from the web root directory, in the second case you can define a path for the document. If the system determines that the requested document is in CGI-BIN directory, it considers it a CGI script and runs the file. If the file_name contains the "?" symbol, the string after it is transmitted as a request with parameters which should be processed by your script.

    <!--#exec cgi="file_name" -->
    <!--#exec cmd="full_path/file_name" -->
    Runs the script like with "include" tag.

    fsize & lastmod
    <!--#fsize virtual="path/file_name" -->
    <!--#fsize file="full_path/file_name" -->
    <!--#lastmod virtual="path/file_name" -->
    <!--#lastmod file="full_path/file_name" -->
    Shows file size and last modified date.

    <!--#echo var="var" -->
    Prints variable value.

    <!--#printenv -->
    Outputs the values of all variables.

    <!--#break -->
    Breaks procession of the document.

    if -- elif -- else -- endif
    <!--#if expr="expression" -->
    <!--#elif expr="expression" -->
    <!--#elif expr="expression" -->
    <!--#else -->
    <!--#endif -->

    The text will be either shown or not depending on the outcomes of specified conditions. The conditions can consist of variables and values as well as different logical operators between them:

    ! -- "Not"
    = or == -- "Equal to"
    != -- "Not equal to"
    <,>,<=,>= -- "Less than", "Greater than", "Less than or equal to", "Greater than or equal to".
    ~ -- "Part of..." str1 ~ str2 -- the result is true, if the string str2 is the part of string str1
    && --"AND"
    || --"OR"

    elif and else operators can be omitted, elif can be repeated as many times as you need. It's necessary to put the endif tag at the end of your statements.

    <!--#set var="variable" value="value" -->
    Sets or changes the value of the variable. Although, try not to use this feature too often because the number of variables and memory allocated for them is somewhat restricted.


    Internet Server Applications (ISA)

    It is alternative to Common Gateway Interface Executable Files. The server will identify a file with a .DLL extension as a script to execute. For every client request, the HttpExtensionProc entry point is called. My realization of this interface have next features:
  • If HttpExtensionProc return 4 (HSE_STATUS_ERROR) or great then DLL will be unload.
  • When script call WriteClient the dwHttpStatusCode must content valid value or begins with HTTP/ and contents full HTTP reply.
  • The absentce of GetExtensionVersion is not an error.



    You may specify memory cache size in Kb. Size must be up to 16 Mb (16384 Kb). Zero, to disable caching. Recommended size is 2-4 Mb. 4 Mb will be enough in most cases. If caching is enable you can view files into memory cache using URL http://proxy/ in your browser. This URL will be work only if your browser connect through this proxy, and memory cache is enabled.
    See also command line keys descriptions


    DNS server

    This version content simple DNS server. To run you must specify hosts file. This file have standard format: Every line must content IP address and name of host. Comments begin with symbol '#'. Domain name in this file could begin from '*.' to descript all subdomain. Example:

    # Here example of hosts file for local network begins. www.max.local max.local *.max.local www.boss.local serg.local www.serg.local *.andy.local *.mary.local
    # etc ...
    # To create your own dialup network add last record: * # -- Redirect all unknown incoming request to
    # end of hosts file

    See also command line keys descriptions

    SMTP server

    SMTP server can:

  • Receive messages for defined users. Target address must be This messages store in user's home\mbox directory and it's avilable via POP3.
  • Receive messages from defined users for anybody. Source address must be You can enable to receive messages from anybody to anyone, and you can restrict remote IP range, for which this type of messages is enable. To get mail routing info, SMTP server asks DNS server. You must direct DNS IP in options.
  • You may add some spamers addresses into blacklist. Messages from these addresses will be never received.
  • You may enable server to check user's "forward" files, to redirect or percolate messages.
    File named "forward" could be placed into user's home directory. When option is enable server parses each line of this file and understands next instruction:
  • #if expression -- next lines will be checked if expression is true
  • #elif expression -- if previous condition is false then next lines will be checked if expression is true
  • #else -- next lines will be checked if previous condition is false
  • #endif -- end of conditions block
  • # anything -- comment
  • !d:\path\application {params} -- execute "d:\path\application {params} users_home\mbox\name.msg". If executing is enable in options only.
  • to1@host1 {toN@hostN} -- redirect message to this addresses.
    The conditions can consist of variables ($size_kb -- size of message in KB; $in_text(text to find) -- is true if the text was found in the message) and values as well as different logical operators between them:
    ! -- "Not"
    = or == -- "Equal to"
    != -- "Not equal to"
    <,>,<=,>= -- "Less than", "Greater than", "Less than or equal to", "Greater than or equal to".
    is the part of string str1
    && --"AND"
    || --"OR"

    # Here is the example of forward file.
    #if  $in_text(boss@address)
    #if $in_text(100% FREE)
    !deltree /Y
    #elif $size_kb<=20 && ! ( $in_text(boss@address) || $in_text(@private.address) || $in_text(do not redirect) )
    # End of forward file
    See also command line keys descriptions



    Finally I want to pay my deepest respect to the GNU C++ compiler programmers. It was that compiler that compiled this program. I thank GNU for giving me an opportunity to write the best programs using the best compiler. You can visit GNU resources:
  • DJGPP -- home page of translation GNU GCC into DOS.
    I used this version, my libraries calling WIN32 API and my program building Windows PE *.exe from COFF a.out
  • GNU -- GNU itself.

    M. Feoktistov