Hi
On Wed, Feb 20, 2013 at 3:43 PM, Sonny Karlsson <[email protected]> wrote: > Hi > > I've been thinking about a potential project for GSoC 2013, an > mk_location core module. > > The module goal would be to translate an URL to a file location using > aliases and rewrites and also limit the number of modules used on a > request. > > The configuration would be located with the vhost information in a > location section. I would suggest something like this, but the > functionality is more important then the actual syntax. > > [Host] > DocumentRoot /var/www/vhost > > [Location /doc] > Alias /var/www/doc > > [Location /images] > Alias /var/www/images > Handler static > > [Location /users] > Rewrite ^/users/{.*}$ /show.cgi?user=$1? > > [Location /show.cgi] > Handler cgi > > The Handler directive would basically restrict the number of modules > which receive the stage30 call. Alias and rewrite would work as they do > in apache and nginx. > > This module would reduce the effort required to produce good plugins for > monkey. Plugins would only almost only care about the file path and > reduce the chance that two plugins try to render the same resource. > With this change, stage_30 could always be trusted to mean that this > request should be rendered. Compatibility will not be a problem as > current plugins already does location matching. To handle location > specific settings would still require plugin changes of course. > > Producing this module wouldn't require too much effort if posix regex is > used. The integration with monkey would probably involve some extra > request_session state and refactoring in mk_http/mk_headers. Rewrites > should be applied before Alias and multiple Rewrite or Aliases > directives on the same Location isn't supported by the configuration > format (correct me if I'm wrong). If rewrite changes the location, that > too should be handled. > > I would very much like to see this in monkey! > > Pretty interesting, definitely it makes a lot of sense to reduce the overhead where each plugin perform it owns match to handle a specific request based in a string comparison. What i would like to see in a different way, is how this is done in the configuration: [Location /users] Rewrite ^/users/{.*}$ /show.cgi?user=$1? that looks pretty much like an Apache or NginX style, but in Monkey the [..] are used to mark a section in the configuration with N rows with 'key value' style. Maybe we have to implement a second level of indentation for the configuration, i am not very clear about the config stuff at the moment, but the functionality and project idea are perfect, best, -- Eduardo Silva http://edsiper.linuxchile.cl http://www.monkey-project.com
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
