Index: openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl,v diff -u -r1.153.2.25 -r1.153.2.26 --- openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 27 Aug 2020 14:55:14 -0000 1.153.2.25 +++ openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 26 Sep 2020 11:40:52 -0000 1.153.2.26 @@ -621,9 +621,6 @@ # Check, if we are supposed to upgrade insecure requests. This # should be after the canonical check to avoid multiple redirects. # - # ns_set get accepts a default value in 3rd argument only on - # NaviServer; so perform the check in two steps for AOLserver - # compatibility. set upgrade_insecure_requests_p [ns_set iget [ns_conn headers] Upgrade-Insecure-Requests] if {$upgrade_insecure_requests_p ne "" && $upgrade_insecure_requests_p @@ -902,14 +899,14 @@ ad_try -auto_abort=false { set rendered_page [ad_parse_template -params $params "/packages/acs-tcl/lib/page-error"] - + } trap {AD EXCEPTION ad_script_abort} {r} { # # ad_parse_template was script-aborted # ns_log warning "rp_report_error: error template with message '$error_message' aborted" return - + } on error {errorMsg} { # # An error occurred during rendering of the error page. @@ -1440,6 +1437,7 @@ ajax_p, behind_proxy_p, behind_secure_proxy_p, + bot_p, browser_id, deferred_dml, extra_url, @@ -1649,17 +1647,36 @@ mobile_p { # - # Check, if we are used from a mobile device (based on user_agent). + # Check, if we are used from a mobile + # device (heuristic based on user_agent). # if {[ns_conn isconnected]} { - set user_agent [string tolower [ns_set get [ns_conn headers] User-Agent]] + set user_agent [string tolower [ns_set iget [ns_conn headers] User-Agent]] set ad_conn(mobile_p) [regexp (android|webos|iphone|ipad) $user_agent] } else { set ad_conn(mobile_p) 0 } return $ad_conn(mobile_p) } + bot_p { + # + # Check, if we are used from a bot + # (heuristic based on user_agent). + # + if {[ns_conn isconnected]} { + if {[::acs::icanuse "ns_conn pool"] && [ns_conn pool] eq "bots"} { + set ad_conn(bot_p) 1 + } else { + set user_agent [string tolower [ns_set iget [ns_conn headers] User-Agent]] + set ad_conn(bot_p) [regexp (crawl|bot) $user_agent] + } + } else { + set ad_conn(bot_p) 0 + } + return $ad_conn(bot_p) + } + ajax_p { # # Check, if we are used from an ajax