httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akins, Brian" <>
Subject Re: Some ramblings on httpd config
Date Thu, 04 Jun 2009 12:17:37 GMT
On 6/4/09 7:51 AM, "Dan Poirier" <> wrote:

>  and having to write a program to
> implement mod_rewrite or a virtual host yourself.

Something like this would be trivial to do:

 if prefix_match(r.uri, "/foo/") then
     return do_redirect(r, "http://somewhere.else/")

 Okay, not a great example, but it's early here :)  The fact that
conditionals are just *there* in lua would make some rewrite operations
easier.  We could also provide plenty of helper stuff (written in lua,

 rr = httpd.rewrite
 rr.rule('/something(.*)', '/other$1')

 -- in handler
 x = r )
 if(x != DECLINED) then
    return x

 if r.env["something"] then
     return proxy:request(r, "")
Like I said, I'm not just thinking of lua as a config, but lua as the
"driver" of httpd.  Or at least provide enough glue for some core modules to
allow us "advanced" users to do this.  We may not need a whole lot of glue
to start with, a few useful ones:

 serve_file(r, "/some/file/on/disk")
 x = do_subrequest(r, uri) -- x could contain headers, bucket brigade (or
just a big string)
 do_redirect(r, location, 301)

Also, it would be nice if we could redo the mod_lua lua-request_rec glue so
that other modules can "mixin" addition functionality:
 require "httpd.util"
 r:redirect(location, 301)

I've been playing with that, but my lua-glue foo is weak.  Something about
the way we are handling the metatable and __index doesn't like that.

Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies

View raw message