home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
srev13g.zip
/
POSTFILT.80
< prev
next >
Wrap
Text File
|
1999-04-08
|
4KB
|
126 lines
/* a sample of a SRE-http "post-filter"
Note it's use of the sref_value to get request specific
info -- and note that when using sref_value to get
request specific info and from
a postfilter procedure, you MUST include the request_number
(the 4th argument- */
/* A very simple transaction recorder (use PMPRINTF to record it)*/
postfilt:
parse arg amessage,source,request,sel,tempfile,servername,host_nickname, ,
used_file,thereferer,reqid,response_status,privset,privset_secret
parse var source serveraddr serverport transaction_number clientaddr clientport
sel=packur(sel)
request=packur(request)
CALL pmprintf_sref(" - - - - - ")
AT=time() ; AD=date()
CALL pmprintf_sref(AT ' ' AD)
call pmprintf_sref('Request # 'reqid'; response status: 'response_status)
CALL pmprintf_sref( " Status Message = " amessage)
CALL pmprintf_sref( " From Server = " servername)
CALL pmprintf_sref( " Client address = " clientaddr)
cALL pmprintf_sref( " Sel (requested URL) = " sel)
call pmprintf_sref( ' File sent (or used) = ' Used_file)
call pmprintf_sref(' Privset:' privset ' (# in privset_secret='words(privset_secret))
a2=sref_value('!ACTIVE',,'REQ',reqid)
call pmprintf_sref(' requests with storage: = ' a2)
a1=sref_value('*',,'REQ',reqid)
do jmm=1 to words(a1)
foo=strip(word(a1,jmm))
a2=sref_value(foo,,'REQ',reqid)
call pmprintf_sref(' Request variable 'foo'='a2)
end
return ' '
/*******************************************************************
*******************************************************************
*******************************************************************/
/*
---------------- General notes ------------------------
SRE-http call this procedure when the POST_FILTER variable is set to YES,
and POSTFILTER_NAME='POSTFILT.80'.
Reminder: You can "chain" post filters (see INITFILT.DOC for details)!
8 arguments are passed here:
amessage
source
request
sel0
tempfile
servername
host_nickname
used_file
Amessage
is generated by SRE-http, and indicates what SRE-http did with this request.
Source,request,and sel0 are generated by GoServe, and contain:
Source
serveraddr serverport transaction_number clientaddr clientport
Request
verb uri protocol
Sel0
action '?' awords (?awords may not be present). Note that to avoid
parsing problems, commas are converted to %2c -- you can convert them
back using the PACKUR function.
Tempfile is set in SRE-http
Tempfile
A temporary file name. It may have been used to construct the response, so you probably should
delete it first (use SYSFILEDELETE(TEMPFILE) ).
Servername
The name of the server to whom this request was directed. This
may be an alias (if you have an appropriate HOSTS. entry).
Host_nickname
The "nickname" for this servername -- used by SRE-http when
looking up parameters, access control, etc.
USED_FILE
The file actually used by SRE-http. Examples include:
the document or .GIF file sent in response to the request.
the CGI script executed.
TheReferer
The value of the 'referer' request header -- if set, it contains
the absolute url which contained the link which invoked this request.
Example of arguments sent:
amessage HTML File sent:/INDEX.HTM
Source 151.121.65.143 80 3 219.134.78.12 1026
request GET /sampask2.htm HTTP/1.0
sel0 sampask2.htm
tempfile D:/GOHTTP/$10.80
servername www.oursite.net
host_nickname www1
params mail.myprovider.net
used_file D:\WWW\SAMPASK2.HTM
Note on Amessage:
The folllowing lists the "messages" that SRE-http may send. Note that the ||varname
means the value of Varname is appended to the message. Also note that when varname=SEL,
the SEL may be different then SEL0 (say, if a ~ replacement occurred).
AWORDS is stuff following a ? in the SEL, ACTION is the stuff before a ?,
AFILE is a file name
Note on host_nickname:
On single host servers, where there are no HOSTS. entries, host_nickname
will be blank.
*/