You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <mx...@apache.org> on 2012/04/30 21:59:38 UTC
new instrospection command
I found useful in some cases to check the running configuration
parameters, particularly when more than one application/virtual host
is running on the same Apache installation. So I extended the
functionalities catered by the undocumented arrays RivetServerConf,
RivetDirConf and RivetUserConf and I got done a first implementation
for an introspection command of Rivet.
I named this command '::rivet::inspect', in order to make it distinctively
different from 'info', since a namespace import from ::rivet into
the global namespace would clash the 2 command definitions.
I don't have a special affection to this name, so I'm open to change it.
My first plan was to make it similar to PHP's phpinfo command, but I admit
I don't know of a straightforward way to store and return the plethora of
information (when meaningful to Rivet) that command caters. Anyway the
dictionary value returned by ::rivet::inspect can be extended to
new values or sections of configuration values.
::rivet::inspect has 3 forms:
1) with no arguments:
[::rivet::inspect] returns a dictionary with 3
subdictionaries having "server","user" and "dir" respectively for keys.
In this form '::rivet::inspect' returns only the configuration
parameters that were set by the admin or user in the conf files.
The dictionary works as a way to preserve compatibility
with the existing RivetServerConf,RivetDirConf and RivetUserConf arrays.
These arrays are maintained by Rivet_PropagateServerConfArrays and
Rivet_PropagatePerDirConfArrays functions in mod_rivet.c. Particularly
Rivet_PropagatePerDirConfArrays has a (though small) performance cost as
it gets run at every request.
Example: placing in BeforeScript the line
array set RivetDirConf [dict get [::rivet::inspect] dir]
would emulate what Rivet_PropagatePerDirConfArrays does, but only when
you need it
Bottom line: those Rivet_Propagate* function in mod_rivet.c can go now
and their arrays created on demand
2) ::rivet::inspect is called in this form:
::rivet::inspect -all
a dictionary is returned where each supported configuration keyword
(see below) is a key to a value read from the current configuration
record (as returned by Rivet_GetConf). Script values undefined are
filled with the string "<undef>"
3) ::rivet::inspect is given a single argument matching one of the
configuration keywords. The corresponding value is returned
Example:
[::rivet::inspect UploadMaxSize]
==> 2000000
Supported configuration keywords are "ServerInitScript",
"GlobalInitScript", "ChildInitScript", "ChildExitScript",
"BeforeScript", "AfterScript", "AfterEveryScript",
"AbortScript", "ErrorScript", "UploadMaxSize",
"UploadDirectory", "UploadFilesToVar", "SeparateVirtualInterps",
"HonorHeaderOnlyRequests"
This is the patch, including changes to mod_rivet.c to assure propagation
of some server configuration scripts.
In mod_rivet.c Rivet_UserConf and Rivet_DirConf are now restricted to
accept only configure scripts that are meaningful to them (child process
initialization and termination are handled at the server scope)
-- Massimo