You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tahiry Ramanamampanoharana <no...@hotmail.com> on 2002/05/03 13:09:55 UTC

mod_rewrite "improved"?

Hi all,

(My english isn't very good so I hope you understand this email)

I am a newbie with apache but I am curently writing an apache module for web 
hosting. I am using mod_rewrite to do mass virtual hosting. The feature that 
I really need in mod_rewrite is RewriteMap. Since I am already writing an 
apache module, I don't want to use an external program to do the mapping 
(External Rewriting Program) and mod_rewrite doesn't offer us to create our 
own internal function. I wanted to hard code my function within mod_rewrite 
but then I saw that APR permits us to write optional functions.

With with APR's optional functions, it's possible to create my own
mod_rewrite optional function. All I have to do is write an optional
function and have mod_rewrite look in the optional functions' hash table for 
it.

I was wondering if this feature can be added as a standard to mod_rewrite in 
the next releases of Apache 2. Right now, each time I switch to a new 
version, I have to remake the modifications.

I attached with this email my version of mod_rewrite.c and mod_rewrite.h and 
all my modifications are marked with something like:
/* ===== START ADDED BY TAHIRY ====== */
The modifications I made in mod_rewrite.c are in cmd_rewritemap().

Can someone look at what I did and tell me if what I did is OK or if there's 
a better way to do it.

Tahiry RAMANAMPANOHARANA


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx

Re: mod_rewrite "improved"?

Posted by Eli Marmor <ma...@netmask.it>.
Cliff Woolley wrote:

> ...
> 
> So mod_include already does this, mod_rewrite should as well.  Right now
> mod_rewrite does a big if/elseif/elseif/.../ set of strcmps.  If it just
> did a hash table lookup instead, we'd be set!

And of course, the best is to use it also for user defined functions as
an alternative for external programs for rewrite_map.

Exactly as you wrote - fabolous!

-- 
Eli Marmor
marmor@netmask.it
CTO, Founder
Netmask (El-Mar) Internet Technologies Ltd.
__________________________________________________________
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-23-7338          Kfar-Saba 44641, Israel

Re: mod_rewrite "improved"?

Posted by Austin Gonyou <au...@coremetrics.com>.
Ahhh....I took your comparison to mean that much of the underlying bits
were similar, thus my query. 

I've looked at both modules and wasn't quite sure how they could be
*that* similar, so I had to ask. :) 

On Fri, 2002-05-03 at 09:42, Cliff Woolley wrote:
> On 3 May 2002, Austin Gonyou wrote:
> 
> > Should mod_include/mod_rewrite become a merge at some point or are
> they
> > too different?
> 
> Whoa... totally different.  mod_include parses documents, mod_rewrite
> manipulates URLs.  When I said it was similar, what I meant was that
> they
.....
NP!
> 
> So mod_include already does this, mod_rewrite should as well.  Right now
> mod_rewrite does a big if/elseif/elseif/.../ set of strcmps.  If it just
> did a hash table lookup instead, we'd be set!
> 
> --Cliff
> 
> 
> --------------------------------------------------------------
>    Cliff Woolley
>    cliffwoolley@yahoo.com
>    Charlottesville, VA
> 
-- 
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-698-7250
email: austin@coremetrics.com

"It is the part of a good shepherd to shear his flock, not to skin it."
Latin Proverb

Re: mod_rewrite "improved"?

Posted by Cliff Woolley <jw...@virginia.edu>.
On 3 May 2002, Austin Gonyou wrote:

> Should mod_include/mod_rewrite become a merge at some point or are they
> too different?

Whoa... totally different.  mod_include parses documents, mod_rewrite
manipulates URLs.  When I said it was similar, what I meant was that they
both have some built in functions but should be extendable by other
modules.

For example, mod_include uses tags like <!--#foo ... -->, where "foo" is a
function name whose corresponding handler function looked up from an
optional function hash table.  Eg, handle_if, handle_else, handle_include,
handle_echo, etc.  See the function include_post_config() and then search
for "handle_func" in send_parsed_content() and you'll see what I mean.

So mod_include already does this, mod_rewrite should as well.  Right now
mod_rewrite does a big if/elseif/elseif/.../ set of strcmps.  If it just
did a hash table lookup instead, we'd be set!

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Re: mod_rewrite "improved"?

Posted by Austin Gonyou <au...@coremetrics.com>.
Should mod_include/mod_rewrite become a merge at some point or are they
too different?

On Fri, 2002-05-03 at 09:01, Cliff Woolley wrote:
> On Fri, 3 May 2002, Tahiry Ramanamampanoharana wrote:
> 
> > With with APR's optional functions, it's possible to create my own
> > mod_rewrite optional function. All I have to do is write an optional
> > function and have mod_rewrite look in the optional functions' hash
> table
> > for it. I was wondering if this feature can be added as a standard to
> > mod_rewrite in the next releases of Apache 2. Right now, each time I
> > switch to a new version, I have to remake the modifications.
> 
> +1... that sounds like a fabulous idea!!  :)  It would be very similar
> to
> what mod_include is now capable of in both design and implementation, I
> think.
> 
> --Cliff
> 
> 
> --------------------------------------------------------------
>    Cliff Woolley
>    cliffwoolley@yahoo.com
>    Charlottesville, VA
> 
> 
-- 
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-698-7250
email: austin@coremetrics.com

"It is the part of a good shepherd to shear his flock, not to skin it."
Latin Proverb

Re: mod_rewrite "improved"?

Posted by Cliff Woolley <jw...@virginia.edu>.
On Fri, 3 May 2002, Tahiry Ramanamampanoharana wrote:

> With with APR's optional functions, it's possible to create my own
> mod_rewrite optional function. All I have to do is write an optional
> function and have mod_rewrite look in the optional functions' hash table
> for it. I was wondering if this feature can be added as a standard to
> mod_rewrite in the next releases of Apache 2. Right now, each time I
> switch to a new version, I have to remake the modifications.

+1... that sounds like a fabulous idea!!  :)  It would be very similar to
what mod_include is now capable of in both design and implementation, I
think.

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA