Small HTTP server

Contents

         

If server works it's available:

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

Registration.

Contacts:

Search with Google:
Google
Web smallsrv.com

Blurb:



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.

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.

Contents



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 http://127.0.0.1/. 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). The files that contents CGI identefer in pathname are files to run. By default CGI identefer is \cgi-bin\, when server receives a request for file in CGI-BIN directory, 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, http://127.0.0.1/My/ is equal to http://127.0.0.1/My/index.htm. Server can support many virtual hosts. Each virtual host has its own root directory, and also can include virtual directories common for all.

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

Contents



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 notification area. 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" Also if server is runed as NT service you may open server's window by Pause/Continue button in Service Control Manatger. noicon
Minimize on startup.hide
Create detailed log for POP/SMTP/FTP. (By default only basic events are added to the log).detail
Disable saving log.nolog
Log filename.log=name.log
Create a daily log (new log created after each day).It's necessary to get statistics for a day. Server will every day rename old log file (add date to name). It's necessary to get statistics for a day.logday
Enable remote administration. Otherwise, only statistics will be available for administrators.radmin
Number of simultaneous requests from each 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=##
IPs that can access this server. Separe single IP by comma and IP ranges with hyphens.ip_range={#.#.#.#[-#.#.#.#],}
Deny IPs that can't access this server. Separe single IP by comma and IP ranges with hyphens.ip_deny={#.#.#.#[-#.#.#.#],}
HTTP server
TCP/IP port for HTTP server. Usually it's 80port=##
Number of HTTP requests working simultaneous. Approcsimately 20Kb of memory is reserved for each thread. Usually 12 connections are enought for 3-8 visitors per minute. max=##
Default file name. Name when requested URL finished by "/". (Wildcards are accepted, such as index.* to allow any index file in folder)def=name.ext
Error file. Full path to file or script that will be returned if requested file is not found. For CGI or SSI QUERY_STRING variable will contents the name of requested file.error=path\name.ext
Default web foulder.dir=root_dir_name
CGI ident.The part of a URL that indicates a CGI script. Default is "\cgi-bin\", but you could 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 Server Side Includes (SSI) checking in HTML files. By default SSI checking in .sht*,.sml*,.asp* files only. Warning: SSI processing uses more memory, and and creates a small delayssihtm
Key to check SSI in .sht*,.sml*,.asp* files only.nossihtm
Limit bytes received by POST method to. Note: Large value may use excessive PC and network resources.post_limit=##
Never execute .htm,.gif,.jpg files. Otherwise, server trays to run any file with CGI ident.norunhtm
Limit CGI execution time. (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.
ext=".ext;application;.ext;application;..."
Mime types
Define extended mime type for extension. E.g. for .bmp mime type may be image/bitmap
mime=".ext1;mime-type1;.ext2;mime-type2;...;.extN;mime-typeN"
Virtual hosts and virtual directory
Web root dir for specific hostname. You may add many hosts with its own folder. You may add many virtual /directory/ common for all hosts. " The name of virtual directory is to be between two forward-slash (/).
hostpath="hostname;path"
Key may be repeated more then once.
Proxy server
Disable HTTP proxy.noproxy
TCP/IP port for proxy server.proxy=#port
Number of proxy requests working simultaneous.proxy_max=#max
IPs that can access this server. Separe single IP by comma and IP ranges with hyphens.proxy_range={#.#.#.#[-#.#.#.#],}
Deny IPs that can't access this server. Separe single IP by comma and IP ranges with hyphens.proxy_deny={#.#.#.#[-#.#.#.#],}
Do not save proxy cache to hard disk.noproxy_dir
Proxy cache 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
Ignore NO-CACHE in control headers of the pages. HTTP protocol has an opportunity to disable caching for page. Often site holders use this option to calculate the number of vistors. In any case, if user press "Reload" button files download again.ignocache
Proxy for avtorized users only. Proxy will be available for defined users with proxy access flag onlyproxyusers
DNS server
Hosts file. See also format of this filehosts=hosts_file
Disable DNS server.nohosts
Disable recursion.noreqursion
Size of cache for names. (in bytes)dnscache
Recursion call to higher level servers only.dnsupl
Return mailhost as host name, if MX record is not found.dnsmx
IPs that can access this server. Separe single IP by comma and IP ranges with hyphens.dns_range={#.#.#.#[-#.#.#.#],}
Deny IPs that can't access this server. Separe single IP by comma and IP ranges with hyphens.dns_deny={#.#.#.#[-#.#.#.#],}
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
Number of simultaneous requests.ftp_max=max
TCP/IP port for FTP server. Usually it is 21ftp_port=port
User session timeout. (in second) Connection will close, if user is idle for this time.ftp_timeout=#N
Name of upload subdirectory.If FTP directory contents this subdirectory, users with \"read only\" access can still upload files here. E.g. /pub/"ftp_upload="/dir/"
Enable virtual directories for FTP.ftp_vdirs
POP3 server setting
Disable POP3 server.nopop3
Number of simultaneous requests.pop3_max=max
TCP/IP port for POP3 server. Usually it is 110pop_port=port
SMTP server setting
Disable SMTP server.nosmtp
Number of simultaneous requests.smtp_max=max
SMTP server name. (Domain name)smtp_name=your.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 sendingsmtp_out=path
Sent path. Directory to store sent messagessmtp_sent=path
Error path. Directory to store messages, on failed sendsmtp_err=path
DNS server to get mail routing info. (May be your default DNS server)smtp_dns=#.#.#.#
Alow any "From" field. Otherwise server will send message from user_name@your.domain.name onlysmtp_any
IPs that can access this server. Separe single IP by comma and IP ranges with hyphens.smtp_range={#.#.#.#[-#.#.#.#],}
Deny IPs that can't access this server. Separe single IP by comma and IP ranges with hyphens.smtp_deny={#.#.#.#[-#.#.#.#],}
Blacklist of E-mail addresses of spamers. Separate addreses by space. Use *@host to block receiving from any address of this host)blacklist="u@adr1 *@adr2 ..."
Use instructions from the "forward" file in a user's directory.forward
Alow execution of applications from user's "forward" file.fwdrun
Users
To give FTP, Mail, Administration access you must add users.
user="name;password;home_dir;type_of_access_flags"
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 user_name@your.domain.name
  • P -- POP3. User will have mailbox. All messages to user_name@your.domain.name 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...
  • H -- Proxy. Access to proxy.
For FTP access you can add anonymous user without password In this case just skip password. E.g.:
user=anonymous;;c:\public;FWN
user=ftp;;c:\readonly;F

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:
log=C:\TEMP\http.log
perl=C:\PERL\BIN\perlis.dll # supported !!!
max=12 def=index.stm
@www.cfg # include other configuration file
hostpath=www.name.www;C:\www1
hostpath=max.name.www;C:\www2
# End of file


Contents



Allowed and denied IP ranges.

For each service you may direct allowed and denied IP addresses. Also present common allowed and denied ranges of IP to blocking or enable access to all TCP services, and ranges that define IPs from where Web administration available. Addresses directed through coma. You might direct one address or range. Example: 127.0.0.1,192.168.0.1-192.168.0.255

HTTP,FTP,POP3,Proxy will receive request from IPs that include in allowed list and exclude denied list.

SMTP will receive the message for own domain (incoming for own users) from any addresses, exclude denied. The messages to send outside, it will get from allowed IPs only If you don't want get any messages from some IP -- just add it to denied list.

DNS server also retrieve local records to anybody, but recursion searching it do for IPs from allowed list only.

Contents



Limits.

You may direct limits for exchange for HTTP,Proxy,SMTP,FTP. For it, in the settings direct time for that will present limit and values for IP, network of this IP, and total limit for the service. Get attention, that when limit will over the exchange will not be break until full file will not be transfer. When limit overflow next calls for the time calculated from overflow value will be failed.

Contents



Running scripts.

Requested files that contents CGI identefer in pathname will be executed. If option "Run 'system' files" selected then files with attribute 'system' will be executed too. 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 )

Contents.


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
    <!--#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 requested document content cgi_ident in path, the server 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
    <!--#exec cgi="file_name" -->
    <!--#exec cmd="file_name" -->
    Runs the script like with "include" tag, from /cgi_ident/ subdirectory

    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
    <!--#echo var="var" -->
    Prints variable value.

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

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

    if -- elif -- else -- endif
    <!--#if expr="expression" -->
    text
    <!--#elif expr="expression" -->
    text
    <!--#elif expr="expression" -->
    text
    ...
    <!--#else -->
    text
    <!--#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
    str1 =~ /pattern/ig -- pattern it is Regular expressions like Unix. The result is be true, if in the string str1 has been found substring equal by pattern.
    && --"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
    <!--#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.

    Contents



    Regular Expressions

    To checking incomming variables finding by pattern avilable. Pattern is regular expressions, with syntax accepted in Unix. Regular expressions it is substring to find. Into this substring also may be present metacharacters,quantifiers and variables. The following metacharacters understen:
  • ^ -- begin of line.
  • . -- any char except new line.
  • \ -- if next character is metacharacter it undesten as just character. E.g. "\." is just point. Also known the following sequensies:
  • [] -- in square bracket may be directed avilable or unavilable values for next char: If first char in the bracket is '^', this mean char may be any except other chars directed in bracket. Otherwise the char may be only one char from the bracket. '-' inside bracket mean all chars from preveous of '-' to char after '-'. The char '\' inside bracket also changed interpretation of next char. Examples:
  • () -- prescribe to save substring by pattern inside bracket for using in futures. The founded substring will be avilable as variables from $1 to $9. The last result also avilable as $+ . The string before last result avilable as $` . The string after last result avilable as $'
  • | -- or.
    After metachar may be present quantifier:
  • * -- repeat 0 or more times.
  • + -- repeat 1 or more times.
  • ? -- may be absent
  • {n} -- repeat 0 or more times.
  • {n,} -- repeat n or more times.
  • {n,m} -- repeat at least n but not more then m times. After any quantifier may by following modifer '?' to lessen pattern distribution up to first posible coincidence. An example when finding in string '123abcdefff567'
    At end of patern, after last slash, may be flowing various modifiers. Nov the program understan next various modifiers:
  • i -- case-insensitive pattern
  • v -- force disable to clear the list of variables ($1 - $9). Without this modifier the program will clear the list in new logical expressions, when the first regular expressions into this logical will begin checking.
  • c -- force clear the list of variables ($1 - $9) before begin. In one logical expressions may be more then one regular expressions. By default all of them use the same list of variables, and e.g. if first expression filled $1 and $2, the second may fill only from $3 If you use this modifer expressions will fill variables begin from $1 independency of result of preveuse part of logical expression.

    Contents



    Internet Server Applications (ISAPI)

    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.

    Contents



    Proxy

    If hard disk cache enabled server will store all incomming files except authorized pages. Server can delete downloaded files from cache proxy directory after several days of last download. You may chouse save downloaded data for long time, and in this case you will have lot of files, and quantity will be grow, and grow, and grow... Some file's systems slowly working when too much of files in directory. For this case use large mode, -- the server create 64 subdirectories and will save the files there. See also command line keys descriptions

    Contents



    DNS server

    This version content DNS server. To run you must specify hosts file. File has format on the one hand compatible with system hosts file and on the other hand may be alike with master file format recomended by RFC 1035. For compatible with system hosts file, each lines may content IP address and name of the host. Comments begin with symbol '#'. Domain name in this file could begin from '*.' to descript all subdomain. Example:

    # Here is an example of hosts file for local network.
    
    192.168.1.21 www.max.local
    192.168.1.21 max.local
    192.168.1.20 *.max.local
    192.168.1.22 www.boss.local
    192.168.1.23 serg.local
    192.168.1.26 www.serg.local
    192.168.1.24 *.andy.local
    192.168.1.25 *.mary.local
    # etc ...
    
    # To create your own dialup network add last record:
    192.168.1.21 * # -- Redirect all unknown incoming request to 192.168.1.21
    
    # end of hosts file
    
    Also each line may content domain-name and RR description and comment may begin with ';' Next lines are supported:
    $ORIGIN <domain-name>
    $TTL <validate-time> -- a 32 bit unsigned integer that specifies the time interval (in seconds) that the resource record may be cached before it should be discarded.
    [<domain-name>] <blank> [<TTL-always-ignored>] IN <type> <RDATA>
    For domain description unlike RFC recomendation you must direct full <domain-name> ('@' dosen't interpretate, last point may be skipped or present it's the same). You may skip <domain-name> in this case preveus name will be used. Unlike RFC recomendation you must direct class "IN" for each line with RR format. <type> may be:
  • A <IP-address> - a host address
  • NS <full-name> - an authoritative name server
  • CNAME <full-name> - the canonical name for an alias. The 'A' record for original name MUST present in this file.
  • SOA <full-name> <e-mail by owner> (<SERIAL>,<REFRESH>,<RETRY>,<EXPIRE>,<MINIMUM>) - marks the start of a zone of authority
  • MX <preference> <full-name> - mail exchange. <preference> is numbre from 1 to 255. Lower values are preferred.
  • PTR <full-name> - a name. Host at left side must be #.#.#.#.in-addr.arpa
    Other types are ignored.
    Also for PTR requests, if PTR record not found, RDATA for reply server gives from first 'A' record with such IP, or from lines compatible with system hosts file. For each type of record domain-name may begin from wildcard '*.' to descrpibe all sub domains. Server supports '*' type of request to return all about domain. For domain with wildcard reply also will content wildcard. For other types of request reply will be without wildcard.

    Server may support reqursion call. To release resolving for any domain you MUST direct NS record for root servers. If you check "Recursion call to up level servers only" you must direct DNS server of your provider, instead root servers, and program will call only to these servers. Otherwise, server will call to different zone servers. Example:

    # Here is an example of hosts file for export domain to Internet,
    # and resolve other names.
    
    ; First, lines holds the information on root name servers needed to
    ; initialize cache of Internet domain name servers
    
    .                  IN  NS a.root-servers.net
    a.root-servers.net IN  A  198.41.0.4
    .                  IN  NS b.root-servers.net
    b.root-servers.net IN  A  128.9.0.107
    .                  IN  NS c.root-servers.net
    c.root-servers.net IN  A  192.33.4.12
    .                  IN  NS d.root-servers.net
    d.root-servers.net IN  A  128.8.10.90
    .                  IN  NS e.root-servers.net
    e.root-servers.net IN  A  192.203.230.10
    .                  IN  NS f.root-servers.net
    f.root-servers.net IN  A  192.5.5.241
    .                  IN  NS g.root-servers.net
    g.root-servers.net IN  A  192.112.36.4
    .                  IN  NS h.root-servers.net
    h.root-servers.net IN  A  128.63.2.53
    
    ; Now declare our domain
    
    $TTL 86400  ;TTL - 24 hours
    
    somedomain.net IN SOA  somedomain.net max@somedomain.net (
     2002120602 ; Serial
     36000      ; Refresh
     3000       ; Retry
     36000000   ; Expire
     36000      ; Minimum
     )
      IN NS   ns.somedomain.net
      IN NS   ns2.somedomain.net
      IN MX 1 relay1.somedomain.net
      IN MX 2 relay2.somedomain.net
      IN A 192.168.12.1
    
    ns.somedomain.net     IN A 192.168.12.1
    ns2.somedomain.net    IN A 192.168.12.2
    relay1.somedomain.net IN A 192.168.12.1
    relay2.somedomain.net IN A 192.168.12.2
    
    pc2.somedomain.net    IN A 192.168.12.2
      IN NS   ns2.somedomain.net
      IN MX 1 relay1.somedomain.net
    
    *.somedomain.net      IN A 192.168.12.1
      IN NS   ns.somedomain.net
      IN NS   ns2.somedomain.net
      IN MX 1 relay1.somedomain.net
      IN MX 2 relay2.somedomain.net
    
    
    ; also this file may contents lines in next format:
    192.168.12.1 www.max.local
    192.168.12.2 max.local
    192.168.12.1 *.max.local
    
    # end of hosts file
    


    See also command line keys descriptions

    SMTP server

    SMTP server can:

  • Receive messages for defined users. Target address must be user_name@your.domain.name This messages store in user's home\mbox directory and it's available via POP3.
  • Receive messages from defined users for anybody. Source address must be user_name@your.domain.name 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. Also server can support common and personal badlist and goodlist files. The names of common lists you may direct in options. Also in options you may enable check personal files named "badlist" and "goodlist" in user's home directories. Each line of these file may be: Example:
    # Begin of file
    @yahoo
    4.79.181.
    67.28.113.
    one@address.com
    lotto
    ? $sender == spamer@address
    ? ! $hello =~ /.+\.[a-z]{2,4}/
    ? $control =~ /\[64.156.215.*\]/
    # End of file
    

  • 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
  • #mv where -- move message
  • #cp where -- copy message
  • #rm -- remove message
  • # anything -- comment
  • !d:\path\application {params} -- execute "d:\path\application {params} users_home\mbox\name.msg". If executing is enable in options only. Also posible to direct variable ($variable_name) in command line, but in this case:
  • 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;
    $text -- full text with head;
    $body -- message body;
    $errorlevel -- the value returned by last external script or zero if no successful runs before) 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"

    str1 =~ /pattern/ig -- pattern it is Regular expressions like Unix. The result is be true, if in the string str1 has been found substring equal by pattern.
    Space and back-slash (' \') at end of line mean continues current command at next line.
    Example:
    # Here is the example of forward file.
    
    #if  $text =~ /\nFrom: .*?boss@address/i
    !d:\perl\bin\perl.exe check.pl
    #endif
    
    #if $in_text(100% FREE)
    #mv c:\probably\spam
    #elif $size_kb<=20 && ! ( $text =~ /^From: .*?([^< ]+?@[^> \r\n]+).*/i && ($1 == my@private.address || $1 == boss@address ) || $in_text(do not redirect) )
    #cp c:\probably\importan
    my_home@address my_seccond_address@yahoo.com
    #else
    !d:\perl\bin\perl.exe autoreply.pl $msgfile $1
    #endif
    
    # End of forward file
    
  • Antivirus script have same format as forward file, but unlike forward file it checking before sending each message. Example:
    # Here is the example of antivirus file.
    
    #if  $text =~ /Content-Transfer-Encoding: ["`]?base64[\001-\xFF]*?\n\r?\nTVqQAAMA/
    
    #if  $text =~ /name=.*\.pif/
    #mv c:\probably\virus
    #else
    !c:\DrWeb\drwebcl.exe /GO /TM- /WA- /TB- /ML
    #endif
    
    #elif $body =~ /<script language=/ && $body =~ /<!DOCTYPE HTML/
    #mv c:\probably\spam
    #endif
    
    # End of file
    

    Break-filter destined to break receiving long size spam messages.
    Break-filter it is logical expression that may do checking after server will receive first 8Kb of the message. If the result of this expression is true, the continues of the message will not be next received, to the "Subject" header's field will be added "[SPAM]", combination of "sender+IP address+server's hello+receptions" will be placed to the temporary bad list, and next tries to send the same messages will be stopped before begin of data transfer.
    Inside expression next variables may be used:
  • $msg -- first 8Kb of the message
  • $sender -- return address
  • $hello -- self identification from remote server.
  • $control -- full identification line in flowing format:
    "From sender (remote_hello [IP]) date and time For receptors\r\n"
    You may include the same actions as in '#if' operator: ||,&&,<,>,>=,<=,==,!=,=~
    The example:
     (! ( $msg =~ /^From:[^\n\r]*<([^>\n\r]+)>/i ||
          $msg =~ /^From:[ \t]*([^\n\r]+)/          )
     )
     || $1 != $sender
     || $msg =~ /^Subject:[^\n\r]*New site|You are win/i
     || $msg =~ /to|for[ \r\n\t]+unsubscribe[ \r\n\t]+[ \r\n\t]+press|go|open|reply|do not/i
    
    In this example: first four lines check does field 'From' is present in the message, and get address from this field, and this address must be the same as sender address (return path); Next line search in the field Subject "New site" or "You are win"; and last line try to detect some strings like "To unsubscribe do something..."
    If any of these condition will be true the message will be detect as spam. See also command line keys descriptions

    POP3 server & proxy

    POP3 server provide access to incomming mail. If POP3 proxy is enabled then users may option their E-mail client's program to get mail from another remote POP3 through this POP3. For it, user option in client's program must be: local_user@remote_user@remote_host
    Password must be: local_password@remote_password
    Or @remote_password part may be added to user option. Anywhere instead '@' may be used '#'.



    FTP server & proxy

    FTP server provide access to home directories of users and if option "Enable virtual directories for FTP" is selected then provide access to private virtual directories. Public virtual directories are unavilable through FTP.
    If FTP proxy is enabled then users may option their FTP client's program to work with remote FTP through this FTP. For it, user option in client's program must be: local_user@remote_user@remote_host
    Password must be: local_password@remote_password
    Or @remote_password part may be added to user option. Anywhere instead '@' may be used '#'.
    Some FTP clients (e.g. FTP plugin for Far manager) support alike type of FTP proxy. In this cliens you may option firewall setting to your_host:FTP_port, and dirrect FTP URL like this: ftp://local_user#remote_user:local_password#remote_password@ftp_host/



    TLS/SSL server

    The server doesn't content real buildin TLS/SSL cryptographic functions, but includes interface to connect external TLS/SSL library. You may connect OpenSSL or GNU TLS to the server. Simple DLL based on OpenSSL 0.9.6j avilable here: seclib.zip

    Contents



    Conclusion

    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


    Contents