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 Karl Lehenbauer <ka...@sc.com> on 2008/04/03 18:40:01 UTC

Apache "Notes" table, Apache tables in general, and Rivet

There's a key-value Apache table called "notes" that's part of  
request_rec structure.

It's used to communicate various stuff between modules.

We came across a need to be able to interface to it from Tcl.  We want  
to stuff the authenticated username into Apache logs using the % 
{varname}n option of CustomLog formatting.  To do that we'd stuff a  
"note" with the username and then invoke that note's name in the log.

There are various bits of code to interface to certain tables defined  
in the request_rec: headers_in, headers_out, and err_headers_out.  Not  
currently used are subprocess_env and notes.

I propose adding a single new C command to Rivet/Tcl to provide  
interfaces to all these tables for getting, setting and inventorying  
their contents.

Something like

    table get tablename key
    table set tablename key value
    table unset tablename key
    table list tablename

I know there is some ability to support multiple entries with the same  
key.  Right now I'm punting on that but I suppose it might need that.   
Perhaps

    table add tablename key value

Anybody have any thoughts, concerns, objections, accolades, remarks,  
hot buttons, flames, etc?

Really I only need an interface to notes but I figured subprocess_env  
could be a good one to be able to mess with as well, at least.   
Conceivably we could eventually simplify by using a more uniform  
interface at the C level as well.  I've got it coded but haven't  
tested it yet.


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Apache "Notes" table, Apache tables in general, and Rivet

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> Something like
> 
>    table get tablename key
>    table set tablename key value
>    table unset tablename key
>    table list tablename
> 
> I know there is some ability to support multiple entries with the same  
> key.  Right now I'm punting on that but I suppose it might need that.   
> Perhaps
> 
>    table add tablename key value

FWIW: To deal with multiple entries for a single key, in Websh we have
an interface that allows to get the count of the entries, while get
either gets the single value or the list of all values. Adapted to
your proposal that would be something like

% table count tablename key
2
% table get tablename key
a b
%

While the result of [table get tablename key] is ambiguous w/o
knowledge about the number of entries (in the example "a b" could
either be a single entry or the two entries "a" and "b"), it's good
enough if it's usually clear from the context whether a sinlge entry
or multiple entries are expected. (We use this succesfully for form
fields and parameters in the query-string.)

As setters, we use

    table set tablename key value ?value ...?
    table lappend tablename key value ?value ...?

... Maybe a bit too fancy though.

Just my .02$ regarding the multiple entries issue.

Ronnie
-- 
Ronnie Brunner | ronnie.brunner@netcetera.ch
phone +41-44-247 79 79 | fax +41-44-247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Apache "Notes" table, Apache tables in general, and Rivet

Posted by David Welton <da...@gmail.com>.
>  I propose adding a single new C command to Rivet/Tcl to provide interfaces
> to all these tables for getting, setting and inventorying their contents.
>
>  Something like
>
>    table get tablename key
>    table set tablename key value
>    table unset tablename key
>    table list tablename
>
>  I know there is some ability to support multiple entries with the same key.
> Right now I'm punting on that but I suppose it might need that.  Perhaps
>
>    table add tablename key value
>
>  Anybody have any thoughts, concerns, objections, accolades, remarks, hot
> buttons, flames, etc?

I'm fine with whatever.  You might look at the [var] command as an
example of how to handle things that might have more than one value,
and so don't fit neatly into a hash table.  On the other hand, I don't
think this is likely to see a whole lot of use, so maybe it's best to
just keep it simple.

-- 
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Apache "Notes" table, Apache tables in general, and Rivet

Posted by Massimo Manghi <ma...@unipr.it>.
Beside cgi environment I can't see a real difference
between 'notes' and 'subprocess_env', thus I can't make up
an opinion about what is preferable. I can understand
that 'notes' is free from the burden of supporting
various things related to cgi, but that's all. Do
you think your code is already at the stage to be tested?

 -- Massimo

On Thu, 3 Apr 2008 11:40:01 -0500, Karl Lehenbauer wrote
> There's a key-value Apache table called "notes" that's part of  
> request_rec structure.
> 
> It's used to communicate various stuff between modules.
> 
> We came across a need to be able to interface to it from Tcl.  We 
> want  to stuff the authenticated username into Apache logs using the 
> % {varname}n option of CustomLog formatting.  To do that we'd stuff 
> a  "note" with the username and then invoke that note's name in the log.
> 
> There are various bits of code to interface to certain tables 
> defined  in the request_rec: headers_in, headers_out, and 
> err_headers_out.  Not  currently used are subprocess_env and notes.
> 
> I propose adding a single new C command to Rivet/Tcl to provide  
> interfaces to all these tables for getting, setting and inventorying 
>  their contents.
> 
> Something like
> 
>     table get tablename key
>     table set tablename key value
>     table unset tablename key
>     table list tablename
> 
> I know there is some ability to support multiple entries with the 
> same  key.  Right now I'm punting on that but I suppose it might 
> need that.   Perhaps
> 
>     table add tablename key value
> 
> Anybody have any thoughts, concerns, objections, accolades, remarks, 
>  hot buttons, flames, etc?
> 
> Really I only need an interface to notes but I figured 
> subprocess_env  could be a good one to be able to mess with as well, 
> at least.   Conceivably we could eventually simplify by using a more 
> uniform  interface at the C level as well.  I've got it coded but 
> haven't  tested it yet.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org


--
Universita' degli Studi di Parma (http://www.unipr.it)


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org