Have a Question?
Print

00702: Program to help see what the BASIC Web Utility Environment looks like

Title:

Program to help see what the BASIC Web Utility Environment looks like

Description:

While using the BASIC Web Utility (BWU), there are times when you’d like to have more information about the environment and the ENV$ and CGI$ string templates in specific. The ENV$ template contains information on the web client’s environment, and the CGI$ template contains information that is sent from the user’s browser. The CGI$ template will only be defined and contain information if the client’s browser specifically sent information to the BWU. For example, setting the browser to: 

http://server/cgi-bin/stdcgi.exe 

will cause the CGI$ template to be null. However, if the browser passes information to the BWU as in: 

http://server/cgi-bin/stdcgi.exe?test_field=Testing_1_2_3 

the CGI$ template will be defined. 


There is a sample program included below (both in non-numbered version for easier reading and numbered so that you can cut and paste it into PRO/5) that will return the templates and their values. 

=============================================================== 

REM this program dumps the environment and cgi data 

call “utcgi.wbb”,env$,cgi$,errmsg$ 

LET ENV_TEMP$=FATTR(ENV$) 
LET ENV_LIST$=FATTR(ENV$,””) 

REM loop through the environment string 
        LET HTML$=ENV_TEMP$+”<br><hr><ul>” 
        LET DONE=0 
        WHILE !(DONE) 
                 LET FPOS=POS($0A$=ENV_LIST$) 
                 IF FPOS<>0 THEN 
:                           LET FLDNAME$=ENV_LIST$(1,FPOS-1); 
:                           LET ENV_LIST$=ENV_LIST$(FPOS+1); 
:                           LET HTML$=HTML$+”<li>”+FLDNAME$+” = “+FIELD(ENV$,FLDNAME$)+”</li>” 
:                  ELSE 
:                           LET DONE=1 
        WEND 
        LET HTML$=HTML$+”</ul><br><hr>” 

LET CGI_TEMP$=FATTR(CGI$,err=done) 
LET CGI_LIST$=FATTR(CGI$,””)          

        REM loop through the cgi string 
        LET HTML$=HTML$+CGI_TEMP$+”<br><hr><ul>” 
        LET DONE=0 
        WHILE !(DONE) 
                 LET FPOS=POS($0A$=CGI_LIST$) 
                 IF FPOS<>0 THEN LET FLDNAME$=CGI_LIST$(1,FPOS-1); 
:                           LET CGI_LIST$=CGI_LIST$(FPOS+1); 
:                           LET HTML$=HTML$+”<li>”+FLDNAME$+” = “+FIELD(CGI$,FLDNAME$)+”</li>” 
:                  ELSE 
:                           LET DONE=1 
        WEND 
        LET HTML$=HTML$+”</ul><br><hr>” 

DONE: 
CALL “uttags.wbb”,”HTML”,HTML$,FINALHTML$ 
CALL “utsend.wbb”,FINALHTML$ 
CALL “utexit.wbb”,CGI$ 

RELEASE 

=============================================================== 

0010 REM this program dumps the environment and cgi data 
0020 CALL “utcgi.wbb”,ENV$,CGI$,ERRMSG$ 
0030 LET ENV_TEMP$=FATTR(ENV$) 
0040 LET ENV_LIST$=FATTR(ENV$,””) 
0050 REM loop through the environment string 
0060 LET HTML$=ENV_TEMP$+”<br><hr><ul>” 
0070 LET DONE=0 
0080 WHILE !(DONE) 
0090 LET FPOS=POS($0A$=ENV_LIST$) 
0100 IF FPOS<>0 THEN LET FLDNAME$=ENV_LIST$(1,FPOS-1); LET ENV_LIST$=ENV_LIST$ 
0100:(FPOS+1); LET HTML$=HTML$+”<li>”+FLDNAME$+” = “+FIELD(ENV$,FLDNAME$)+”</l 
0100:i>” ELSE LET DONE=1 
0110 WEND 
0120 LET HTML$=HTML$+”</ul><br><hr>” 
0130 LET CGI_TEMP$=FATTR(CGI$,ERR=DONE) 
0140 LET CGI_LIST$=FATTR(CGI$,””) 
0150 REM loop through the cgi string 
0160 LET HTML$=HTML$+CGI_TEMP$+”<br><hr><ul>” 
0170 LET DONE=0 
0180 WHILE !(DONE) 
0190 LET FPOS=POS($0A$=CGI_LIST$) 
0200 IF FPOS<>0 THEN LET FLDNAME$=CGI_LIST$(1,FPOS-1); LET CGI_LIST$=CGI_LIST$ 
0200:(FPOS+1); LET HTML$=HTML$+”<li>”+FLDNAME$+” = “+FIELD(CGI$,FLDNAME$)+”</l 
0200:i>” ELSE LET DONE=1 
0210 WEND 
0220 LET HTML$=HTML$+”</ul><br><hr>” 
0230 DONE: 
0240 CALL “uttags.wbb”,”HTML”,HTML$,FINALHTML$ 
0250 CALL “utsend.wbb”,FINALHTML$ 
0260 CALL “utexit.wbb”,CGI$ 
0270 RELEASE 

=============================================================== 
Sample Output 
=============================================================== 

COMPUTERNAME:C(1*=0),COMSPEC:C(1*=0),CONTENT_LENGTH:C(1*=0),CVSROOT:C(1*=0),GATEWAY_INTERFACE:C(1*=0),HTTP_ACCEPT:C(1*=0),HTTP_ACCEPT_LANGUAGE:C(1*=0),HTTP_HOST:C(1*=0),HTTP_USER_AGENT:C(1*=0),HTTP_ACCEPT_ENCODING:C(1*=0),HTTPS:C(1*=0),INCLUDE:C(1*=0),INSTANCE_ID:C(1*=0),LIB:C(1*=0),LOCAL_ADDR:C(1*=0),MSINPUT:C(1*=0),NUMBER_OF_PROCESSORS:C(1*=0),OS2LIBPATH:C(1*=0),OS:C(1*=0),PATH:C(1*=0),PATH_TRANSLATED:C(1*=0),PATHEXT:C(1*=0),PROCESSOR_ARCHITECTURE:C(1*=0),PROCESSOR_IDENTIFIER:C(1*=0),PROCESSOR_LEVEL:C(1*=0),PROCESSOR_REVISION:C(1*=0),QUERY_STRING:C(1*=0),REMOTE_ADDR:C(1*=0),REMOTE_HOST:C(1*=0),REQUEST_METHOD:C(1*=0),SCRIPT_NAME:C(1*=0),SERVER_NAME:C(1*=0),SERVER_PORT:C(1*=0),SERVER_PORT_SECURE:C(1*=0),SERVER_PROTOCOL:C(1*=0),SERVER_SOFTWARE:C(1*=0),SYSTEMDRIVE:C(1*=0),SYSTEMROOT:C(1*=0),USERPROFILE:C(1*=0),WINDIR:C(1*=0)

——————————————————————————– 

COMPUTERNAME = SERVER 
COMSPEC = C:\WINNT\system32\cmd.exe 
CONTENT_LENGTH = 0 
GATEWAY_INTERFACE = CGI/1.1 
HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, */* 
HTTP_ACCEPT_LANGUAGE = en-us 
HTTP_HOST = double 
HTTP_USER_AGENT = Mozilla/4.0 (compatible; MSIE 4.01; Windows NT) 
HTTP_ACCEPT_ENCODING = gzip, deflate 
HTTPS = off 
INCLUDE = C:\Program Files\comm\Mts\Include 
INSTANCE_ID = 1 
LIB = C:\Program Files\comm\Mts\Lib 
LOCAL_ADDR = 192.168.1.192 
MSINPUT = C:\Program Files\util\intellipoint 
NUMBER_OF_PROCESSORS = 1 
OS2LIBPATH = C:\WINNT\system32\os2\dll; 
OS = Windows_NT 
PATH = C:\WINNT\system32;C:\WINNT;C:\Program Files\comm\Mts 
PATH_TRANSLATED = C:\Inetpub\wwwroot 
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.JS 
PROCESSOR_ARCHITECTURE = x86 
PROCESSOR_IDENTIFIER = x86 Family 5 Model 8 Stepping 0, AuthenticAMD 
PROCESSOR_LEVEL = 5 
PROCESSOR_REVISION = 0800 
QUERY_STRING = test_field=Testing_1_2_3 
REMOTE_ADDR = 192.168.1.4 
REMOTE_HOST = 192.168.1.4 
REQUEST_METHOD = GET 
SCRIPT_NAME = /cgi-bin/stdcgi.exe 
SERVER_NAME = double 
SERVER_PORT = 80 
SERVER_PORT_SECURE = 0 
SERVER_PROTOCOL = HTTP/1.0 
SERVER_SOFTWARE = Microsoft-IIS/4.0 
SYSTEMDRIVE = C: 
SYSTEMROOT = C:\WINNT 
USERPROFILE = C:\WINNT\Profiles\Default User 
WINDIR = C:\WINNT 


——————————————————————————– 
TEST_FIELD:C(1*=0) 

——————————————————————————– 

TEST_FIELD = Testing_1_2_3 


——————————————————————————– 



Last Modified: 03/31/2004 Product: BASIC Web Utility Operating System: N/A

BASIS structures five components of their technology into the BBx Generations.

Table of Contents
Scroll to Top