httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gruno <>
Subject Ideas for an output filter for mod_lua
Date Wed, 22 Aug 2012 11:00:50 GMT
Hi dev@,
I've been wondering (and tinkering with) the idea of creating output
filters through mod_lua. If this has already been discussed, it was
before my time here, so please forgive any redundant ideas.

Essentially, what I'd like to do is be able to do the following:

LuaOutputFilter myTestFilter /www/filter.lua filter_handle
<FilesMatch "\.txt$">
    SetOutputFilter myTestFilter

and then, through coroutines or some such, make the following filter in Lua:

-- [[ A simple filter mechanism ]] --
function filter_handle(r)
  coroutine.yield() -- Yield and wait for buckets
  while (buffer) do -- buckets are sent through the global var 'buffer'
                    -- and set to 'nil' when there are no more buckets
    local escaped = r:escape_html(buffer)
    coroutine.yield(escaped) -- pass on the bucket

I've already made and tested a prototype of this, and it seems like
something that could be of use to the public.

So, any feedback, comments, thoughts on this?

With regards,

View raw message