• Publicity: Public Only All

filter-procs.tcl

Procs intended for use as NaviServer/OpenACS request filters. This file contains reusable filters for rejecting unwanted requests and protecting the normal connection pool from excessive anonymous traffic. The filters can be parameterized when registered for particular HTTP methods and URL patterns.

Location:
packages/acs-tcl/tcl/filter-procs.tcl

Procedures in this file

Detailed information

util::reject_anonymous_on_high_load_filter (public)

 util::reject_anonymous_on_high_load_filter why [ args... ]

Reject an anonymous request when either the number of matching active requests OR the request queue length exceeds its configured limit while a matching request is executed. Authenticated requests are exempt from this filter. Without -match, count requests whose URL path equals the current request's path, as returned by ns_conn url. Requests with different query parameters but the same path therefore belong to the same group. With -match, apply the supplied Tcl glob pattern to the URL path. The pattern used to register the filter determines which requests invoke it; it does not define the active-request grouping. The active count includes the current request and matching requests from both anonymous and authenticated users. Both limits use snapshots; this filter does not reserve execution capacity or enforce a strict concurrency bound. The filter is active only in the connection pools specified by -pools. The empty pool name denotes the default connection pool. Example:

    ns_register_filter  postauth  GET /bugtracker/*  ::util::reject_anonymous_on_high_load_filter  -what "bugtracker request"  -pools [list ""]  -max_running 3  -max_queued 10  -retry_after 60

Parameters:
why (required)
filter stage, normally postauth
Returns:
filter_ok or filter_return

Partial Call Graph (max 5 caller/called nodes):
ad_conn ad_conn (public) ad_log ad_log (public) util::reject_anonymous_on_high_load_filter util::reject_anonymous_on_high_load_filter util::reject_anonymous_on_high_load_filter->ad_conn util::reject_anonymous_on_high_load_filter->ad_log

Testcases:
No testcase defined.

util::reject_request_filter (public)

 util::reject_request_filter why what

Reject a request from a NaviServer filter. This proc is intended for use with ns_register_filter, in particular for early preauth filters that reject unwanted probe, scanner, or otherwise unsupported request paths before the OpenACS request processor performs canonical-host redirects or page dispatch. When used as a preauth filter, the proc performs the minimal ad_conn setup needed by the OpenACS request processor cleanup path. Example:

    ns_register_filter -first preauth POST /PSEMHUB/* ::util::reject_request_filter "PeopleSoft probe"

Parameters:
why (required)
filter stage, e.g. preauth
what (required)
short description of the rejected request
Returns:
filter_return

Partial Call Graph (max 5 caller/called nodes):
ad_conn ad_conn (public) util::reject_request_filter util::reject_request_filter util::reject_request_filter->ad_conn

Testcases:
No testcase defined.
[ show source ]