home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / srev13h.zip / POSTFILT.80 < prev    next >
Text File  |  1999-04-07  |  4KB  |  126 lines

  1. /* a sample of a SRE-http "post-filter"
  2.   Note it's use of the sref_value to get request specific
  3.   info -- and note that when using sref_value to get
  4.   request specific info and from 
  5.   a postfilter procedure, you MUST include the request_number
  6.   (the 4th argument- */
  7.  
  8. /* A very simple transaction recorder (use PMPRINTF to record it)*/
  9.  
  10. postfilt:
  11.  
  12. parse arg amessage,source,request,sel,tempfile,servername,host_nickname, ,
  13.            used_file,thereferer,reqid,response_status,privset,privset_secret
  14.  
  15.  
  16. parse var source serveraddr serverport transaction_number clientaddr clientport
  17. sel=packur(sel)
  18. request=packur(request)
  19. CALL pmprintf_sref("  - - - - - ")
  20. AT=time() ; AD=date()
  21. CALL pmprintf_sref(AT ' ' AD)
  22. call pmprintf_sref('Request # 'reqid'; response status: 'response_status)
  23. CALL pmprintf_sref( "      Status Message = "  amessage)
  24. CALL pmprintf_sref( "         From Server =  " servername)
  25. CALL pmprintf_sref( "      Client address = "  clientaddr)
  26. cALL pmprintf_sref( " Sel (requested URL) = "  sel)
  27. call pmprintf_sref( ' File sent (or used) = ' Used_file)
  28. call pmprintf_sref(' Privset:' privset ' (# in privset_secret='words(privset_secret))
  29.  
  30. a2=sref_value('!ACTIVE',,'REQ',reqid)
  31. call pmprintf_sref(' requests with storage: = ' a2)
  32.  
  33. a1=sref_value('*',,'REQ',reqid)
  34. do jmm=1 to words(a1)
  35.    foo=strip(word(a1,jmm))
  36.    a2=sref_value(foo,,'REQ',reqid) 
  37.    call pmprintf_sref(' Request variable 'foo'='a2)
  38. end
  39. return ' '
  40.  
  41.  
  42. /*******************************************************************
  43.  *******************************************************************
  44.  *******************************************************************/
  45.  
  46. /*
  47.          ---------------- General notes  ------------------------
  48.  
  49. SRE-http  call this procedure when the POST_FILTER variable is set to YES,
  50. and POSTFILTER_NAME='POSTFILT.80'.
  51.  
  52. Reminder: You can "chain" post filters (see INITFILT.DOC for details)!
  53.  
  54. 8 arguments are passed here:
  55.     amessage
  56.     source
  57.     request
  58.     sel0
  59.     tempfile
  60.     servername
  61.     host_nickname
  62.     used_file
  63.  
  64. Amessage 
  65.     is generated by SRE-http, and indicates what SRE-http did with this request.
  66.  
  67. Source,request,and sel0 are generated by GoServe, and contain:
  68.  
  69.   Source 
  70.        serveraddr serverport transaction_number clientaddr clientport
  71.   Request
  72.     verb uri protocol 
  73.   Sel0
  74.     action '?' awords  (?awords may not be present).  Note that to avoid
  75.     parsing problems, commas are converted to %2c -- you can convert them
  76.     back using the PACKUR function.
  77.  
  78. Tempfile is set in SRE-http
  79.   Tempfile
  80.     A temporary file name. It may have been used to construct the response, so you probably should
  81.     delete it first (use SYSFILEDELETE(TEMPFILE) ).
  82.  
  83. Servername
  84.    The name of the server to whom this request was directed.  This
  85.    may be an alias (if you have an appropriate HOSTS. entry).
  86.  
  87. Host_nickname
  88.     The "nickname" for this servername -- used by SRE-http when
  89.     looking up parameters, access control, etc.
  90.  
  91. USED_FILE
  92.    The file actually used by SRE-http.  Examples include:
  93.         the document or .GIF  file sent in response to the request.  
  94.         the CGI script executed.
  95.  
  96. TheReferer
  97.    The value of the 'referer' request header -- if set, it contains
  98.    the absolute url which contained the link which invoked this request.
  99.  
  100. Example of arguments sent:
  101.      amessage               HTML File sent:/INDEX.HTM
  102.      Source                151.121.65.143 80 3 219.134.78.12 1026
  103.      request                GET /sampask2.htm HTTP/1.0
  104.      sel0                   sampask2.htm
  105.      tempfile               D:/GOHTTP/$10.80
  106.      servername             www.oursite.net
  107.      host_nickname          www1   
  108.      params                mail.myprovider.net
  109.      used_file             D:\WWW\SAMPASK2.HTM
  110.  
  111. Note on Amessage:
  112.   The folllowing lists the "messages" that SRE-http may send.  Note that the ||varname
  113.   means the value of Varname is appended to the message.  Also note that when varname=SEL,
  114.   the SEL may be different then SEL0 (say, if a ~ replacement occurred).
  115.   AWORDS is stuff following a ? in the SEL, ACTION is the stuff before a ?,
  116.   AFILE is a file name
  117.  
  118. Note on host_nickname:
  119.    On single host servers, where there are no HOSTS. entries, host_nickname
  120.    will be blank.
  121.  
  122.  
  123. */
  124.  
  125.  
  126.