SREhttp/2 Manual || Technical outline

### SREhttp/2 post-response procedures

In certain cases, you may wish to execute some additional actions after responding to a client's request. For example, you may wish to record client specific information in a custom designed audit file. Or, you may wish to e-mail responsible parties when certain events occur (such as a file upload). Or you may wish to do both!

To accomodate such needs, SREhttp/2 can be told to call up to five post-response procedures. As with the pre-response procedure, these post-response procedures are custom designed REXX procedures.

#### Notes:

- To enable use of post-response procedures, set the POST_RESPONSE variable(s) in PRELOADS.CFG
- You use the SET POST_RESPONSE selector-specific option to suppress, or modify, the POST_RESPONSE procedure(s).

`Note:` | The post-response procedure(s) are called after a response has been sent to the client. Therefore, you can not use a post-response procedure to modify the response sent to the client!

### Example of a Post Response Procedure

This demonstates the several arguments passed to the post response procedure.
For more details on arguments passed to post-response procedures, see POSTRESP.REX (in SREHTTP2\PROCS).

    parse arg request_line,source,sel0,seluse2,reqnum,user , ,
               fileused,rcode,host_nickname,id_info,post_response

    foo=sre_pmprintf( "")
    foo=sre_pmprintf("For request number "reqnum,1)
    foo=sre_pmprintf("   : Original request_line= " ||request_line,1)
    foo=sre_pmprintf("   : Host nickname= "host_nickname,1)
    foo=sre_pmprintf("   : Source= "source,1)
    foo=sre_pmprintf("   :   Selector (after URL-decoding)=" sel0,1)
    foo=sre_pmprintf("   :   Selector after redirection=" seluse2,1)
    foo=sre_pmprintf("   :   User= " user,1)
    foo=sre_pmprintf("   :   FileUsed = " fileused,1)
    foo=sre_pmprintf("   :   Response code: " rcode,1)
    foo=sre_pmprintf("   :   Post_Response: "||post_response,1)
    foo=sre_pmprintf("   :   ID_INFO: "||left(id_info,80)||' ...',0)
    foo=sre_pmprintf(" ")
    return 0

SREhttp/2 comes with several post-response procedures, all of them are stored in the SREHTTP2\PROCS directory:

- `POSTRESP.REX`: a simple example, it displays the various arguments supplied by SREhttp/2 to all post-response procedures
- `POSTRCRD.REX`: a simple "event notifier" -- a small report is written to a file if a URI is requested, or a file is sent to a client. Requires editing of user-configurable parameters in POSTRCRD.REX.
- `POSTMAIL.REX`: a simple e-mail based notifier (requires an SMTP gateway).
- `CHK_POST.REX`: The post-response component of the CHECK-404 deny access to probing attacks utility.