ns_locationproc - Register custom location handler
This command installs a custom script which will return location string for the current connection, as returned by ns_conn location. Usually, a location looks like http://localhost/. ns_locationproc registers the handler for the current server. Therefore, the command cannot be used in the configuration script (no current server, defining the setup of all servers), but in the module files.
The Tcl script will be called returning the location string, containing the URL scheme (protocol) and the authority (hostname and port) in the syntax as specified by the HTTP RFCs.
When the optional arguments are provided, these are added to the command script to be executed. Therefore, two invocation styles are supported: either providing a script, or a command with additional arguments.
namespace eval nstest { ns_locationproc ::nstest::location ad_proc ::nstest::location {args} { set location [ns_conn protocol]://[ns_set get -nocase [ns_conn headers] host] ns_log notice "LOCATION-PROC args <$args> - location <$location>" return $location } }