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 bots
The 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):
%3 packages/acs-subsite/lib/user-new.tcl packages/acs-subsite/ lib/user-new.tcl util::block_request util::block_request packages/acs-subsite/lib/user-new.tcl->util::block_request packages/acs-subsite/www/register/index.tcl packages/acs-subsite/ www/register/index.tcl packages/acs-subsite/www/register/index.tcl->util::block_request ad_return_complaint ad_return_complaint (public) util::block_request->ad_return_complaint ad_script_abort ad_script_abort (public) util::block_request->ad_script_abort util::request_info util::request_info (public) util::block_request->util::request_info

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

[ hide source ] | [ make this the default ]
Show another procedure: