Hi Raul,
The error message means that at the time this proc was called, the server was not yet defined. Simply speaking, you called the proc too early.
The configuration file determines several parameters which are applicable for multiple servers, later, the defined servers are initialized (loading modules, etc.). You can see this as well from the prefix used in the error.log.
When one loads this at some later time, - maybe in your OpenACS package nstest - you will see during sourcing a message like
[03/Mar/2023:13:19:38.295950][-main:oacs-5-10-] Notice: SOURCING location-procs.tcl
where "oacs-5-10" is the name of the server. Note that OpenACS has - since ages - several features controlled via package parameters and host-node map to produce its own understanding of the "current location" [1]. So, if you change the lower-level semantics, the likelihood to change some behavior is greater than 0.
The example in the man page is from the NaviServer regression test - so probably not the best. Put this following file e.g. to the "tcl" directory of one of your packages (using for instance the name location-procs.tcl).
namespace eval nstest {
ns_locationproc ::nstest::location
ad_proc ::nstest::location {args} {
set location [ns_conn protocol]://[ns_set iget [ns_conn headers] host]
ns_log notice "LOCATION-PROC args <$args> - location <$location>"
return $location
}
ns_log notice "SOURCING location-procs.tcl <[ns_info server]>"
}
Hope, this helps.
The main question for me is, why you do not want to stick with the standard behavior.
all the best -g
[1] https://openacs.org/api-doc/proc-view?proc=util_current_location&source_p=1