Forum OpenACS Development: Re: Image resizing, exec and server problems

Collapse
Posted by Stefan Sobernig on
Michael, To get the ns_proxy family of commands registered with the driver and connection interpreters, you have to options:
  1. add the following entry to your etc/config.tcl:
    # ...
    if {[ns_info version] >= 4.5} {
      if {[file exists ${bindir}/nsproxy.so]} {                
        ns_param	nsproxy		${bindir}/nsproxy.so        
      }        
      ns_limits set default \
          -maxupload [ns_config ns/server/${server}/module/nssock maxinput]
    }
    # ...
    
    Note, I added it to the 4.5+ branch as it won't be available below. You also need to check for its very existence, otherwise, the you will experience a crash. that would be the option for using malte's "ns_proxy proxy".
  2. as you outlined above, an on-demand / or lazy initialisation in your code (convenient for testing purposes). in xotcl jargon, as I assume that you stick with it:
    Class X -proc init args {
       if {[info command ns_proxy] eq "" && \
     	    [file exists [ns_info home]/bin/nsproxy.so]} {
           load [ns_info home]/bin/nsproxy.so
           # create a proxy pool 
           ns_proxy config my_pool
         }
         next
    }
    
    Provided that you class object is defined in a *-procs.tcl file, the constructor "init" will only be called once, upon initial sourcing in the driver thread. The "info command" expression takes care for its deployment in www/* scripts.
hope it helps, //stefan
Collapse
Posted by Michael Totschnig on
thank you Stefan for the explanation.
I think, since there is code in acs-tcl that gives acces to ns_proxy when it is loaded, it should be included into the sample config file distribibuted with OpenACS. Ubuntu seems to put the library into the lib directory and it is called libnsproxy though.