util::block_request (public)
util::block_request -condition condition [ -target target ]
Defined in packages/acs-tcl/tcl/utilities-procs.tcl
Block a request from application-level Tcl code when a given condition evaluates to true. This proc is intended for use from pages, callbacks, or other code that runs after the OpenACS request processor has already accepted and initialized the request. It can be used to disallow selected requests, for example requests from bot pools on login pages or other application entry points. This proc is not suitable for rejecting requests that must be blocked before OpenACS request processing, canonical-host redirects, or page dispatch. For such cases, e.g. scanner probes for foreign application paths, use an early NaviServer filter such as ::util::reject_request_filter registered with ns_register_filter. If the condition is true and the connection is still active, the proc logs the request, returns a complaint page to the client, and aborts the script. Otherwise, it returns normally without producing output. Example:
::util::block_request -condition {[ns_conn pool] eq "bots"} -target bots
- Switches:
- -condition (required)
- Tcl expression evaluated in the caller's scope. When the expression evaluates to true, the request is blocked.
- -target (optional, defaults to
"you")- Short description used in the message shown to the client.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.