home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
ONLINE
/
SREFPRC1
/
CGIVARS.SRF
< prev
next >
Wrap
Text File
|
1996-10-08
|
4KB
|
121 lines
/* Procedure to return a value of one of the CGI-Bin variables
Note that:h SCRIPT_NAME, PATH_INFO, PATH_TRANSLATED, and REMOTE_IDENT,
PATH_INFO, PATH_TRANSLATED, and QUERY_STRING are not available. When
one of these variables is requested, a ' ' is returned
Note that this will NOT look in environment, but will determine the
values each time. In other words, this not designed for use
in cgi-bin scripts (you should use x=value(varname,,'os2environment)
instead); it is designed for use in INTERPRET includes and in
directly called REXX server side programs).
*/
sref_cgivars:
parse arg findme
findme=strip(strip(findme),,'"')
putme=' '
select
when findme="DOCUMENT_NAME" then do
if symBol('AFILE')='VAR' then putme=afile
end
when findme="DOCUMENT_URI" then do
if symBol('SELORIGINAL')='VAR' then putme=seloriginal
end
when findme="DATE_LOCAL" then do
putme=date()
putme=putme||' '||time()
end
when findme="DATE_GMT" then do
putme=sref_new_gmt()
parse var putme eek ',' d1 d2 d3 .
putme=d1||' '||d2||' '||d3
end
when findme="LAST_MODIFIED" then do
if symBol('AFILE')='VAR' then do
eek=sysfiletree(translate(afile,'\','/'),gosh,'F')
poop=gosh.1
parse var poop adate atime .
putme =adate
putme=putme||' '||atime
end
end /* last modified */
when findme="SERVER_SOFTWARE" then do
filter_name=sref_version()
putme=server('H')||' '||filter_name
end
when findme="SERVER_NAME" then
putme=servername()
when findme="GATEWAY_INTERFACE" then
putme="CGI/1.1"
when findme="SERVER_PROTOCOL" then do
putme=extract(serverprotocol)
end
when findme="SERVER_PORT" Then do
putme=extract(serverport)
end
when findme="REQUEST_METHOD" then do
putme=extract(clientmethod)
end
when findme="PATH_INFO" then
putme=" "
when findme="PATH_TRANSLATED" Then
putme=" "
when findme="SCRIPT_NAME" then do
putme=' '
end
when findme="QUERY_STRING" then
if symBol('awords')='VAR' then putme=awords
when findme="REMOTE_HOST" then DO
putme=clientname()
end
when findme="REMOTE_ADDR" then do
putme=extract(clientaddr)
end
when findme="AUTH_TYPE" then
putme="Basic Access Authentication Scheme"
when findme="AUTH_NAME" then do
afield=reqfield('Authorization')
parse var afield . m64 . /* get the encoded cookie */
dec=pack64(m64) /* and decode it */
parse upper var dec putme ':' .
end
when findme="REMOTE_IDENT" then
putme=" "
when findme="CONTENT_TYPE" then
putme=REQFIELD("Content-type")
when findme="CONTENT_LENGTH" then
putme=REQFIELD("Content-length")
when abbrev(findme,"HTTP_") then do
if findme="HTTP_ACCEPT" then do
i = 1
_acc = REQFIELD("accept")
acc = '%'
ClientAccepts = ''
do while (acc \= _acc)
acc = REQFIELD("accept", i)
if (ClientAccepts \= '') then ClientAccepts = ClientAccepts', 'acc
else ClientAccepts = acc
i = i+1
end
putme=clientaccepts
end
else do
parse var findme . '_' findme2
putme=reqfield(findme2)
end
end
otherwise
putme=' '
end /* select */
return putme