You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Cliff Woolley <jw...@virginia.edu> on 2002/05/06 08:53:38 UTC

dbm rewritemaps

I'm converting mod_rewrite to use apr_dbm_* instead of its homegrown
flavor.  The only problem I see with it is that it will require a
configuration change for the user to specify what kind of dbm they want.
Right now, the RewriteMap is set up as follows:

RewriteMap mymap dbm:/path/to/dbm

I propose to change that as follows: dbm will mean "default", but the user
can specify "db:", "gdbm:", or "sdbm:" instead of "dbm:" to get a specific
flavor.

Comments?  I'd like a few +1's before I spend much more time on this.

--Cliff

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


Re: dbm rewritemaps

Posted by Justin Erenkrantz <je...@apache.org>.
On Mon, May 06, 2002 at 03:10:32AM -0400, Cliff Woolley wrote:
> On Mon, 6 May 2002, Justin Erenkrantz wrote:
> 
> > Hint: look at apr_dbm_open_ex.  =)  -- justin
> 
> I know that, I've been looking at it for like an hour now.  :)  That's
> why I said "dbm" would get translated into "default" by mod_rewrite.  I
> almost explicitly said:
> 
> apr_dbm_open_ex(..., "default", ...)
> 
> in my last email.  Ugh.  ;]  You didn't answer my question though.  Is it
> acceptable for
> 
> RewriteMap mydbm dbm:/path/to/dbm
> 
> to mean apr_dbm_open_ex(..., "default", ...) ?

What I was thinking was:

RewriteMap mydbm default:/path/to/dbm

since apr_dbm_open_ex could handle that.  (The dbm->default mapping
makes a lot of sense to maintain backwards compatibility.)

But (as you just pointed out to me on IRC), RewriteMap can also take
txt, prg, etc.  So, having "default" may be ambiguous.  Your call if
you want to allow "default" as a type - I think it may be more hassle
to prevent default than it would be to just allow it.  -- justin

Re: dbm rewritemaps

Posted by Cliff Woolley <jw...@virginia.edu>.
On Mon, 6 May 2002, Justin Erenkrantz wrote:

> Hint: look at apr_dbm_open_ex.  =)  -- justin

I know that, I've been looking at it for like an hour now.  :)  That's
why I said "dbm" would get translated into "default" by mod_rewrite.  I
almost explicitly said:

apr_dbm_open_ex(..., "default", ...)

in my last email.  Ugh.  ;]  You didn't answer my question though.  Is it
acceptable for

RewriteMap mydbm dbm:/path/to/dbm

to mean apr_dbm_open_ex(..., "default", ...) ?

--Cliff

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



Re: dbm rewritemaps

Posted by Justin Erenkrantz <je...@apache.org>.
On Mon, May 06, 2002 at 03:03:46AM -0400, Cliff Woolley wrote:
> So you want:
> 
> RewriteMap mydbm default:/path/to/dbm
> 
> ???  That doesn't make a lot of sense to me.  The map type needs to
> indicate that it's a dbm somehow.  I was saying that "dbm" should get
> translated into "default" by mod_rewrite, meaning that the following:

Hint: look at apr_dbm_open_ex.  =)  -- justin

Re: dbm rewritemaps

Posted by Cliff Woolley <jw...@virginia.edu>.
On Sun, 5 May 2002, Justin Erenkrantz wrote:

> > I propose to change that as follows: dbm will mean "default", but the user
> > can specify "db:", "gdbm:", or "sdbm:" instead of "dbm:" to get a specific
> > flavor.
>
> +1.  (In addition, "default" should be allowed too.)  -- justin

So you want:

RewriteMap mydbm default:/path/to/dbm

???  That doesn't make a lot of sense to me.  The map type needs to
indicate that it's a dbm somehow.  I was saying that "dbm" should get
translated into "default" by mod_rewrite, meaning that the following:

RewriteMap mydbm dbm:/path/to/dbm

would be the default DBM type, as opposed to:

RewriteMap mydbm sdbm:/path/to/dbm
RewriteMap mydbm gdbm:/path/to/dbm
RewriteMap mydbm db:/path/to/dbm

which would be one of the specific types.

--Cliff

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



Re: dbm rewritemaps

Posted by Justin Erenkrantz <je...@apache.org>.
On Mon, May 06, 2002 at 02:53:38AM -0400, Cliff Woolley wrote:
> 
> I'm converting mod_rewrite to use apr_dbm_* instead of its homegrown
> flavor.  The only problem I see with it is that it will require a
> configuration change for the user to specify what kind of dbm they want.
> Right now, the RewriteMap is set up as follows:
> 
> RewriteMap mymap dbm:/path/to/dbm
> 
> I propose to change that as follows: dbm will mean "default", but the user
> can specify "db:", "gdbm:", or "sdbm:" instead of "dbm:" to get a specific
> flavor.

+1.  (In addition, "default" should be allowed too.)  -- justin

Re: dbm rewritemaps

Posted by Cliff Woolley <jw...@virginia.edu>.
On Mon, 6 May 2002, Eli Marmor wrote:

> I thought that apr_dbm is a replacement of SDBM (this is written in too
> many places and documents...).

It did used to be that way.  Not anymore.  :)

Thanks,
Cliff

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



Re: dbm rewritemaps

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

> > I am also not sure regarding the alternative DBs of SDBM: Either we
> > should make apr_dbm an abstraction layer that will support them too
> > (may cause licensing problems), or we should ignore them.
> 
> It already is such a layer, if I understand what you're saying.  apr_dbm
> lets you choose which flavor you want: sdbm, gdbm, or db.  Of the ones it
> detects on your system, it picks one as a default in case you just don't
> care.  I have all three, and it picks SDBM as the default on my system.

Oops...
Sorry...
I thought that apr_dbm is a replacement of SDBM (this is written in too
many places and documents...).
Next time I should look at the source before writing...

-- 
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: dbm rewritemaps

Posted by Cliff Woolley <jw...@virginia.edu>.
On Mon, 6 May 2002, Eli Marmor wrote:

> Do you mean INSTEAD of the "txt:"?

Um, no.  I'm just fixing the "dbm:" flavor.  "int:", "prg:", "rnd:", and
"txt:" would remain.  :)

> (by the way: use the APR-UTIL functions for it, rather than SDBM).

That's what I'm talking about.

> I am also not sure regarding the alternative DBs of SDBM: Either we
> should make apr_dbm an abstraction layer that will support them too
> (may cause licensing problems), or we should ignore them.

It already is such a layer, if I understand what you're saying.  apr_dbm
lets you choose which flavor you want: sdbm, gdbm, or db.  Of the ones it
detects on your system, it picks one as a default in case you just don't
care.  I have all three, and it picks SDBM as the default on my system.

My only concern is that someone will have an existing configuration that
uses RewriteMap ... dbm:... and will have a dbm database that's some other
flavor than the one APR-util picks by default (say, SDBM), and it will
stop working until they change their config to be more specific.

--Cliff

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



Re: dbm rewritemaps

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

> I'm converting mod_rewrite to use apr_dbm_* instead of its homegrown
> flavor.

Do you mean INSTEAD of the "txt:"?
I'm afraid that it will break many files, compatibilities, and
existing installations.
In addition, TXT map files are easier for tests, debugging, learning,
etc.
Can't it be done IN ADDITION to "txt:" and not INSTEAD?

>          The only problem I see with it is that it will require a
> configuration change for the user to specify what kind of dbm they want.
> Right now, the RewriteMap is set up as follows:
> 
> RewriteMap mymap dbm:/path/to/dbm
> 
> I propose to change that as follows: dbm will mean "default", but the user
> can specify "db:", "gdbm:", or "sdbm:" instead of "dbm:" to get a specific
> flavor.

We can't adopt SDBM on one hand (apr_dbm), but default to DBM on the
other hand.
IF there is a default, it should be SDBM (by the way: use the APR-UTIL
functions for it, rather than SDBM).
I don't think that there should be any default. Alternatively, the
default should be "txt:".
I am also not sure regarding the alternative DBs of SDBM: Either we
should make apr_dbm an abstraction layer that will support them too
(may cause licensing problems), or we should ignore them.

But in any case, we can't adopt a format (SDBM) as a standard, and
later - ignore what we already built.

P.S. your initiative is great, and my notes are only regarding the
compatibility with the existing files on one hand, and with the
APR-UTIL library on the other hand.
-- 
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