BTWCGI - Bin To Win CGI
run WinCGI applications from StandardCGI Environment


BTWCGI is a small (31K) and fast 32bit console application that allows a Windows CGI applications (8bit, 16bit or 32bit) to run as a STANDARD CGI applications on Win32-based Web Servers.

BTWCGI verifies the Content, so You can use "multipart/form-data"-forms (i.e. File Attachments) also on those Web Servers, that not supports this type of data or those, that damages the Boundary.

Current Windows CGI implementation looks like (plus/minus :-) ) version 1.3a and [Extra Headers]-compatible with the previous Windows CGI versions.

 
USAGE

WAY 1: Without renaming original Windows CGI application.

To use this way, copy "BTWCGI.EXE" to the same directory where placed your Windows CGI application (i.e. "D:\PATH\CGI-BIN") and or (WAY 1a) to the same name like your Windows CGI application but with extension ".CGI" (or other, but not ".EXE", depending on your Web Server software) or (WAY 1b) to the same name like your Windows CGI application plus any character at the end of file name (before extension) and call it instead of original.

    Note: your Windows CGI application itself must have extension ".EXE"!

    Example: for your Windows CGI application called "MYPROG.EXE" do

      COPY BTWCGI.EXE MYPROG.CGI
        or
      COPY BTWCGI.EXE MYPROG_.EXE

WAY 2: By changing extension of original Windows CGI application to specific associated extension.

To use this way, create custom unique extension (for example ".BTW") and associate it to open with "BTWCGI.EXE" in Windows' File Types or/and in Web Server settings,


Windows 98 Association Example


24Link Web Server Mapping Example

change extension ".EXE" of original Windows CGI application to the new one and call it directly.

    Note: don't rename "BTWCGI.EXE"!

    Example: for your Windows CGI application called "MYPROG.EXE" do

      REN MYPROG.EXE MYPROG.BTW

 
SPECIFICATION

BTWCGI translates the CGI variables using the following "dictionary":

Windows CGI Idents Standard CGI Environment Value Remark
[CGI]
Request Protocol SERVER_PROTOCOL  
Request Method REQUEST_METHOD  
Request Keep-Alive HTTP_[KEEP_ALIVE|CONNECTION]  
Executable Path SCRIPT_NAME  
Document Root DOCUMENT_ROOT Can set in 'AUTOEXEC.BAT'
Logical Path PATH_INFO  
Physical Path PATH_TRANSLATED  
Association Parameter ASSOC_PARAM  
Query String QUERY_STRING  
Request Range HTTP_REQUEST_RANGE  
Referer HTTP_REFERER  
From HTTP_FROM  
User Agent HTTP_USER_AGENT  
Content File CONTENT_FILE Duplicated in [System]
Content Type   Verified 'CONTENT_TYPE'
Content Length [HTTP_]CONTENT_LENGTH  
Server Software SERVER_SOFTWARE  
Server Name SERVER_NAME  
Server Port SERVER_PORT  
Server Admin SERVER_ADMIN Can set in 'AUTOEXEC.BAT'
CGI Version   CGI/1.3a (Win)
Remote Host REMOTE_HOST  
Remote Address REMOTE_ADDR  
Authentication Realm AUTH_NAME  
Authenticated Username [AUTH_|REMOTE_]USER[_NAME]  
Authenticated Password [AUTH_|USER_]PASSWORD  
Authentication Method AUTH_TYPE  
[System]
GMT Offset GMT_OFFSET Can set in 'AUTOEXEC.BAT'
Debug Mode DEBUG_MODE Can set in 'AUTOEXEC.BAT'
Output File OUTPUT_FILE  
Content File CONTENT_FILE Duplicated in [CGI]
[Form Literal]
[Form External]
[Form Huge]
[Form File]
[Accept]
many HTTP_ACCEPT Direct or by FileName
[Extra Headers]
many HTTP_* WinCGI/1.1 Compatible
[Crypto]
SecureConnection HTTPS  
[BTWCGI]
BTWCGI Version   BTWCGI/1.4
Server CGI Version GATEWAY_INTERFACE  
Server Content Type [HTTP_]CONTENT_TYPE  

*** Windows CGI specification of Robert B. Denny - http://solo.dc3.com/wsdocs/32demo/windows-cgi.html.
*** Standard CGI specification - http://web.golux.com/coar/cgi/.
*** Special thanks to Jim Schmidt - author of IS2WCGI.


COMPATIBILITY

Tested with the following HTTP servers (on Windows 98):

non-Windows CGI servers:

Windows CGI servers (through the STANDARD CGI environment, "/cgi-bin/"):

*** Listed in alphabet order, not by preference :-) .


LICENSE AGREEMENT

This program belongs to Netstrap Ltd. (www.netstrap.com), it is written by Aryeh Eiderman <leib@netstrap.com> using Delphi 4 and it is FREE for commercial and non-commercial use.


HISTORY

Ver. 0.9
o basic implementation of Windows CGI version 1.2,
o "application/x-www-form-urlencoded" content,
o using API's WritePrivateProfileString.

Ver. 1.0
o direct (no API) IniFile building - faster way.

Ver. 1.1
o added "multipart/form-data"-content parsing,
o implemented Windows CGI version 1.3a.

Ver. 1.2
o added boundary search and correction for servers that have a bug of "multipart/form-data"-content transfer or that have not this feature at all.

Ver. 1.3
o content-file error fix,
o no Ident-name limitations.

Ver. 1.4
o free environment fix,
o self call enhancement.


DOWNLOAD

Press here to download BTWCGI Version 1.4, released May-7-2001 (40K, this page encluded).


BTWCGI Home - http://www.netstrap.com/btwcgi/btwcgi.htm.