On 6/4/09 7:51 AM, "Dan Poirier" <poir...@pobox.com> 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/") end 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, probably). rr = httpd.rewrite rr.rule('/something(.*)', '/other$1') .... -- in handler x = rr.run( r ) if(x != DECLINED) then return x end if r.env["something"] then return proxy:request(r, "http://some.domain.com") end 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:serve_file("/some/file" 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