httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Basant Kukreja <Basant.Kukr...@Sun.COM>
Subject Re: Dropping mod_sed into /trunk/ ?
Date Sat, 23 Aug 2008 04:57:16 GMT
Hi,
   There is one important aspect of mod_sed design (which is borrowed from Sun
Web Server) that I would like to emphasize is that sed code has been separated
from filter code. So sed code itself can be archived in a shared/static library
(let me call it as libsed). mod_sed filter code is just one consumer of libsed.

Typical usage of libsed is :
sed_commands_t cmd
sed_init_commands(&cmd, ...);
sed_compile_string(&cmd, string1);
sed_compile_string(&cmd, string2);
sed_finalize_command(&cmd);

// Run eval on compiled context any number times.
sed_eval_t eval;
sed_init_eval(&eval, ...);
sed_eval_buffer(&eval, ...);
sed_finalize_eval(&eval, ...);

// finally destroy the evaluation and compile context
sed_destroy_eval(&eval);
sed_destroy_commands(&cmd);
--------------------------------------------------------

Having said that, I would like to emphasize the sed command and evaluation
context doesn't store any thread local storage. What this means is that
multiple commands and evalution context can be created within a single thread.
This means multiple consumers of libsed can be consumed safely in a single
thread.

This way, any number of apache modules can make use of sed libraries and
coexist in a same thread. If developers like this idea then one option is to
drop libsed code into apr and drop mod_sed.c (which is a sed filter module)
into apache code.

libsed code lies in sed0.c sed1.c and regexp.c regexp.h libsed.h
Whereas filter code is in mod_sed.c
http://src.opensolaris.org/source/xref/webstack/mod_sed/

Regards,
Basant.


On Wed, Aug 20, 2008 at 11:53:58PM +0100, Nick Kew wrote:
> A little while ago, Basant Kukreja published mod_sed under the
> Apache license.  He's now also written a blog entry that could
> become the basis for a tutorial into how mod_sed is much more
> than a mere string-or-regexp search-and-replace filter:
> 
> http://blogs.sun.com/basant/entry/using_mod_sed_to_filter
> 
> I happen to know that Basant and Sun will be happy for us
> to adopt mod_sed, and I think that with that blog entry
> reworked into a howto doc, it'll add real value to httpd.
> 
> Any thoughts on dropping it in to trunk, with a view
> to including it as standard in 2.4 in due course?
> 
> -- 
> Nick Kew
> 
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.org/

Mime
View raw message