Windows CGI

The WINCGI-interface is a direct interface to pure Windows backend programs (16 and 32 bits). Thus it's easy to write backends in ACCESS, C, Foxpro, VB or any other programming language. This enables you to use Windows specific features, such as DDE, OLE and even ODBC.

How the WINCGI works
The server provides the input data for the called Windows program on the command line, a private profile and a content file. The content file contains additional data sent by the client. On the output side the called Windows program generates an output file, which is sent to the client.

Command line
Four command line parameters are needed

  • The fully qualified name of the private windows profile,

The directory used for the input and output files is defined in aliAdmin. During script development it is useful to turn off automatic deleting of generated files.

For more information on these parameters see Section [WINSCRIPTALIAS] in the Registry description.

Example how a WINCGI program is called:

C:\HTTPD\CGI-BIN\TSTWIN.EXE c:\tmp\xxxx.ini
INI file for parameter passing: Section [CGI]
Each entry works like the environment variables set in the standard CGI interface, for a detailed description see Scripts, CGI and how it works. The section CGI contains following entries:

  • REQUEST PROTOCOL name/revision of the protocol used
  • REQUEST METHOD GET, POST or HEAD
  • EXECUTEABLE PATH logical path of the CGI program
  • LOGICAL PATH additional path information if needed by the script
  • PHYSICAL PATH the logical path with aliases expanded
  • QUERY STRING the information in the URL after the question mark
  • REFERER URL of the document that includes the CGI call
  • FROM if set by the client: the email address of the user
  • CONTENT TYPE MIME type of attachment if existing
  • CONTENT LENGTH attachment length
  • CONTENT FILE name of attachment file
  • SERVER SOFTWARE name/version of webserver i.e. Alibaba/1.0
  • SERVER NAME host name of the server
  • SERVER PORT internet port number used
  • SERVER ADMIN email address of the administrator
  • CGI VERSION 'CGI/1.2 (Win)' for now
  • REMOTE HOST host name of the client
  • REMOTE ADDRESS IP address of the client
  • AUTHENTICATION METHOD 'BASIC' method used for authenticating CGI access
  • AUTHENTICATION REALM which group of users is allowed access
  • AUTHENTICATED USERNAME username within realm
Section [ACCEPT]
All accept fields received are written in the form accept=quality
1 is assumed if not stated otherwise

    Example:
    
    [ACCEPT]
    
    text/plain=1.00
    
    text/html=1.00
    
    audio/x-aiff=1.00
    
    audio/basic=1.00
    
    */*=1.00
    
Section [SYSTEM]
  • GMT OFFSET number of seconds the local time differs from GMT. This is a positive value for regions east of Greenwich (Europe, Asia), a negative for regions westwards (USA)
  • DEBUG MODE normally set to zero
  • CONTENT FILE is the private profile ini filename.
  • OUTPUT FILE the name of the output file sent to the client.
Section [EXTRA HEADERS]
Here all values retrieved by a get command are included, in name=value manner.

Example:

    [EXTRAHEADERS]

    var1=Value_1

    var2=Value_2
Section [FORM LITERAL]
Here all values retrieved by a POST command are included, in name=value manner. In this section we place all values which are less then 1500 bytes, if they are longer, they are put into section [FORM EXTERNAL].

Section [FORM EXTERNAL]
Here all values retrieved by a POST command are included, in name=filename size manner. The files contain the values without any modification. Be sure to read them with binary file attributes, so that no automatic conversion takes place.

Example:

    NAME_VAR=c:\tmp/03147835.0 181777
Section [FORM HUGE]
If a string in the content file is more than 64kB, it is referenced here in the form name=offset length. Offset points to the beginning of the string in the content file and length is the size of the string. Both values are in bytes. Be sure to open the content file in binary mode, so that no automatic conversion takes place.


Copyright © 1997 Omnicron Technologies Corporation