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.23 -r1.1.2.24 --- openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 14 Jan 2021 21:35:43 -0000 1.1.2.23 +++ openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 17 Feb 2021 20:51:42 -0000 1.1.2.24 @@ -110,11 +110,14 @@ ::acs::register_icanuse "ns_writer" {[info commands ::ns_writer] ne ""} ::acs::register_icanuse "nsv_dict" [acs::cmd_error_contains {nsv_dict get ""} -varname] -# The feature NaviServer to return a dict as result of "ns_http run" -# came at the same time, when "ns_http stats" was introduced. +# +# The following commands check indirectly the availability, since the +# commands require connections etc. These features were introduced +# after the queried functionality was introduced. +# ::acs::register_icanuse "ns_http results dict" [acs::cmd_has_subcommand ns_http stats] +::acs::register_icanuse "ns_conn peeraddr -source" [acs::cmd_has_subcommand ns_connchan status] - # # 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.30 -r1.153.2.31 --- openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 1 Feb 2021 10:51:09 -0000 1.153.2.30 +++ openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 17 Feb 2021 20:51:42 -0000 1.153.2.31 @@ -1636,18 +1636,26 @@ return 0 } peeraddr { - if {[ns_config "ns/parameters" ReverseProxyMode false]} { + # + # Newer versions of NaviServer (4.99.20) + # handle already ReverseProxyMode + # internally. + # + if {![acs::icanuse "ns_conn peeraddr -source"] + && [ns_config "ns/parameters" ReverseProxyMode false] + } { + # # Try to get the address provided by a # reverse proxy such as NGINX via - # X-Forwarded-For, if available + # X-Forwarded-For, if available. + # set headers [ns_conn headers] set i [ns_set ifind $headers "X-Forwarded-For"] if {$i > -1 } { return [ns_set value $headers $i] } } - # return the physical peer address - return [ns_conn $var] + return [set ad_conn(peeraddr) [ns_conn peeraddr]] } mobile_p {