You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Doug MacEachern <do...@opengroup.org> on 1997/06/11 04:14:01 UTC

Re: Thoughts on a 2.0 API

> it after the response (say, during the logging phase), it won't do what is
> expected. But they can choose whether A happens first, or B. And vary it
> according to host/port/URL.
> 
> In my system, there are still phases, but they are more fluid - determined
> by the configuration. This would mean that a straight URL->file mapping, for
> example, would do almost nothing, and run _really_ fast.
> 
> <Host fast.somewhere.com>
>  <URL /(.*):path:>
>   File /usr/local/wwwdocs/$path
>  </URL>
> </Host>

I might be jumping in without fully understanding the discussion (or
the syntax), but this is already quite simple with Perl:

#httpd.conf
<Perl>
#push a handler to step in at the translate stage
push @PerlTransHandler, sub {
     my $r = shift;
     my $host = $r->get_remote_host;

     if($host =~ /^fast.somewhere.com$/) {
        if($r->uri =~ /(.*)/) {
           $r->filename("/usr/local/wwwdocs/$1");
           return OK;
        }
     }        
     return DECLINED;
};
</Perl>

Of course, this doesn't need to be in the config file, the subroutine
can be defined in a file, config would just be something like:

PerlTransHandler  My::translate

-Doug

> Cheers,
> 
> Ben.
> 
> -- 
> Ben Laurie                Phone: +44 (181) 994 6435  Email: ben@algroup.co.uk
> Freelance Consultant and  Fax:   +44 (181) 994 6472
> Technical Director        URL: http://www.algroup.co.uk/Apache-SSL
> A.L. Digital Ltd,         Apache Group member (http://www.apache.org)
> London, England.          Apache-SSL author
> 

Re: Thoughts on a 2.0 API

Posted by Brian Behlendorf <br...@organic.com>.
On Tue, 10 Jun 1997, Doug MacEachern wrote:
> I might be jumping in without fully understanding the discussion (or
> the syntax), but this is already quite simple with Perl:

Doug, is it conceivable that Perl could be used as a configuration
loader, but not be a part of the httpd executable?  Maybe with dld the
perl module can "unload" itself, but I guess I mean something even
more divided... 

	Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS