Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.95.2.15 -r1.95.2.16 --- openacs-4/packages/acs-tcl/acs-tcl.info 13 Jul 2020 12:02:33 -0000 1.95.2.15 +++ openacs-4/packages/acs-tcl/acs-tcl.info 26 Sep 2020 11:40:52 -0000 1.95.2.16 @@ -9,7 +9,7 @@ f t - + OpenACS The Kernel Tcl API library. 2017-08-06 @@ -18,7 +18,7 @@ GPL version 2 3 - + Index: openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl,v diff -u -r1.1.2.14 -r1.1.2.15 --- openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 21 Sep 2020 11:28:56 -0000 1.1.2.14 +++ openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 26 Sep 2020 11:40:52 -0000 1.1.2.15 @@ -85,24 +85,20 @@ # loading order. # +::acs::register_icanuse "ns_asynclogfile" {[info commands ::ns_asynclogfile] ne ""} +::acs::register_icanuse "ns_conn contentsentlength" [acs::cmd_has_subcommand ns_conn contentsentlength] +::acs::register_icanuse "ns_conn partialtimes" [acs::cmd_has_subcommand ns_conn partialtimes] +::acs::register_icanuse "ns_conn pool" [acs::cmd_has_subcommand ns_conn pool] +::acs::register_icanuse "ns_crypto::randombytes" {[info commands ::ns_crypto::randombytes] ne ""} ::acs::register_icanuse "ns_db currenthandles" [acs::cmd_has_subcommand ns_db currenthandles] +::acs::register_icanuse "ns_hash" {[info commands ::ns_hash] ne ""} +::acs::register_icanuse "ns_ictl trace idle" [acs::cmd_error_contains {ns_ictl trace foo} idle] ::acs::register_icanuse "ns_server unmap" [acs::cmd_has_subcommand ns_server unmap] ::acs::register_icanuse "ns_set keys" [acs::cmd_has_subcommand ns_set keys] ::acs::register_icanuse "ns_setcookie -samesite" [acs::cmd_error_contains ns_setcookie -samesite] - -::acs::register_icanuse "ns_conn partialtimes" [acs::cmd_has_subcommand ns_conn partialtimes] -::acs::register_icanuse "ns_conn contentsentlength" [acs::cmd_has_subcommand ns_conn contentsentlength] +::acs::register_icanuse "ns_writer" {[info commands ::ns_writer] ne ""} ::acs::register_icanuse "nsv_dict" [acs::cmd_error_contains {nsv_dict get ""} -varname] -::acs::register_icanuse "ns_crypto::randombytes" {[info commands ::ns_crypto::randombytes] ne ""} - -::acs::register_icanuse "ns_asynclogfile" {[info commands ::ns_asynclogfile] ne ""} -::acs::register_icanuse "ns_writer" {[info commands ::ns_writer] ne ""} -::acs::register_icanuse "ns_hash" {[info commands ::ns_hash] ne ""} - -catch {ns_ictl trace foo} ::errorMsg -::acs::register_icanuse "ns_ictl trace idle" {"idle" in [split $::errorMsg " "]} - # # Add some compatibility procs for AOLserver or older NaviServer versions # 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