util::block_request (public)
util::block_request -condition condition [ -target target ]
Defined in packages/acs-tcl/tcl/utilities-procs.tcl
Block a request for certain kind of requests. This proc can be used to disallow, e.g., requests from bots in login pages or similar. Example:
::util::block_request -condition {[ns_conn pool] eq "bots"} -target botsThe proc either terminates the requests by responding a blocking message to the client, or it continues and returns nothing.
- Switches:
- -condition (required)
- Tcl expression, blocking condition
- -target (optional, defaults to
"you"
)- part of the message string presented to the blocked user
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {[ns_conn isconnected] && [uplevel 1 [list expr $condition]]} { ns_log notice "blocking request for condition $condition\n" [util::request_info] ad_return_complaint 1 "page is not allowed for $target" ad_script_abort }XQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-tcl/tcl/utilities-procs.xql