Re: websh - safe interps and other questions
- From: Ronnie Brunner <ronnie.brunner@xxxxxxxxxxxx>
- Date: Wed, 10 Dec 2008 14:08:02 +0100
APN wrote:
- websh does not seem to use safe interps. This would seem to be an
ideal place to use that particular Tcl feature to protect against
programmer errors. Any reason why safe interp's would not work? Any
way of configuring the websh interpreter to be safe?
No reason why a safe interp would not work, but since the safe interp you'd invoke will not contain any websh functionality, it is relatively useless, not just safe...
You could tweak the htmlhandler.ws3 wrapper to eval some page or code in a safe interp instead of directly in the master interp. But as I said: none of the functionality websh provides will be available. And currently, you cannot load libwebsh.so in the safe interp, as there is no Websh_SafeInit procedure. (Might be done I guess, but I never really explored the possibilities / limitations ...)
- Does websh fire a new interp for every web request? The docs seem to
indicate this is configurable (number of requests handled before the
interp is deleted). Does that mean any data (globals for instance)
left over from processing a request is available in subsequent
requests?
Yes. Use web::interpclasscfg to set the number of requests to be handled by an interpreter. (Note however, that usually a subsequent request is not handled by the same interp, so be very careful when passing info from request to request...)
Ina typical prefork Apache environment you have plenty of independent processes with plenty of interps each: changes are pretty slim to hit the same interp twice.
- Does websh use the Tcl installation on the system or does it have
its own built-in interpreter? auto_path from within websh shows the
system's Tcl installation directories. Is this because websh was built
on that system ? How does one configure websh to use a separate area
for loading packages etc.
mod_websh doesn't have any special means to configure the environment. Setting the proper environment when you start Apache however will make sure that you have the desired Tcl lib, init.tcl etc...
- Can binary Tcl extensions be loaded into websh ? In particular, I
need a database interface.
Yes: [load] is your friend
hth
Ronnie
--
Ronnie Brunner | ronnie.brunner@xxxxxxxxxxxx
phone +41-44-247 79 79 | fax +41-44-247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch
.
- Follow-Ups:
- References:
- websh - safe interps and other questions
- From: APN
- websh - safe interps and other questions
- Prev by Date: Re: Using Pipes???
- Next by Date: Re: Bluetooth Serial Port Profile and Tcl communications
- Previous by thread: websh - safe interps and other questions
- Next by thread: Re: websh - safe interps and other questions
- Index(es):
Relevant Pages
|