httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@organic.com>
Subject Re: Items for 1.2
Date Sun, 28 Jul 1996 19:01:16 GMT
On Sun, 28 Jul 1996, Ralf S. Engelschall wrote:

> > [...]
> > 3) mod_rewrite. mod_rewrite_compat probably needs more testing, but I'd
> >    like to place mod_rewrite into the default distribution. *However*,
> >    having looked at the module's source in greater depth, I'd like to
> >    make a number of changes first (Ralf, do you mind? Or if you'd perfer
> >    to make them yourself, that'd be fine):
> 
> First, please give me a change to try it myself in v2.1 and if the result
> isn't good enough please do some more changes yourself. But send my all
> changes back to me, because I want to maintain mod_rewrite myself.  And
> because I'm written mod_rewrite for the Apache team and not for myself I will
> try hard to change anything as the Apache team wants. I don't want to have a
> own mod_rewrite which is different from the mod_rewrite which is included in
> the Apache distribution.

Sounds good to me. If you'd make the changes, that'd be fine.

> >    a) Obviously, it needs to be rewritten to use POSIX regex instead of
> >       V8. The one nick here is POSIX regex' lack of an equvilent of
> >       regsub(). However, this should be very simple to write (and should
> >       be put into util.c for use by other functions).
> 
> Yes, this is on my todo list. It would be nice if you could support a regsub
> function, because it is allways useful to have one, not even for mod_rewrite.
> If you supply such a beast, mod_rewrite v2.1 will contains changes to support
> the POSIX interface of the regexp code apache includes.

I'll go ahead and write one (a pool-based one, even) and stick it in
util.c. It looks pretty easy (famous last words).

> BTW: The current CVS-snapshot still hasn't the regexp code included. Not yes
> commited?

See other messages on this subject; Ben screwed up :)

> >    b) It's not quite up to the normal Apache API standards. Specifically,
> >       the way it parses args, handles errors, and a couple other things.
> 
> Hmmm... please give me more details, Alex.
> What did I make wrong? The arg parsing uses the "raw" functionality of
> Apaches config and it is the only possibile way to get 3 args and to avoid \\
> instead of \, etc.

Ugh. You're right, of course. (getword_conf should really be changed to
pass on \ unless it's escaping a quote; it'd probably be usable then).

> Error handling: Ok, that could be better: Just give some hints I will change
> it. 

mod_rewrite currently uses for errors:

fprintf(stderr, "error");
exit(1);

What it should do, for directives, is use:

return "error";

(this is why they're prototyped as char*). Apache will then assemble a
nice-looking syntax error for the user, if it's on startup, or return a
500 response if it's in an .htaccess file.

For a failure to open the log, doing that is fine, though. After all, it's
what all the other logging modules do :)

The other thing is I really would advise you to use
"STANDARD_MODULE_STUFF", not what you're doing now. For one thing, it
won't work :) Apache doesn't actually check that field, so there's really
no point. It just messes things up. (It probably should, but that's a
whole other story).

> >    c) Memory use. It uses MAX_STRING_LEN all over the place. Most of that
> >       can (and should) be replaced with the pstr* functions.
> 
> Hmmm... yes. I will change this in v2.1, you are right.
> 
> >    d) The RewriteEngine directive seems superfluous; it should be implied
> >       by the existance of RewriteRule.
> 
> Hmmmm.... yes and no! I introduced it to be able to disable the whole engine
> while RewriteRule directives are setup. If you don't have this directive you
> have to comment out all RewriteRule directives which can be horrible,
> e.g. I have 20-30 directives in my httpd.conf!

Not with <IfModule> (which I'm about to go commit). Just surround your
directives with:

<IfModule fake_module>
.... directives here ...
</IfModule>

But I see your point. Hmm. Not sure.

> >    e) RewriteLog should default to off.
> 
> Yes! That is a good decision. I currently still changing the logging facility
> and will do this change, too.
> 
> >    f) Most importantly, it should not, ever, under any circumstances,
> >       change r->uri, as it does now. It should keep track of its
> >       internal state in an internal variable. I'm also not sure about
> >       making URI and filesystem paths treated the same; it seems to have
> >       the propensity to get messy; I have to think more about it, though.
> 
> Hu! You are faster then me, Alex! This is NO#1 on my todo list, because
> it causes some problems, e.g.
>    1. a redirect in mod_imap.c causes the homesubdirs (e.g. .html-data or
>       .www) to be used.
>    2. the tidle expansion (~user -> /.../user, etc.) takes please
>       even on redirects and should only be done for real uri-to-filename
> 	  changes
>    etc.
> 
> I want to do it this way in v2.1:
> 
> mod_rewrite uses internal buffers for r->uri and r->filename. The
> RewriteRules are per default applied to the filename. But there is a option
> to be able to apply a rule to the URI (for rewrites prior to redirects, etc.)
> At the end of a rewriting process, it sets r->filename and if the uri was
> also rewritten, it sets r->uri, too.
> 
> Is this ok?

That sounds good. As long as r->uri isn't touched unless it's specifically
asked to be.

> >    However, except for these things (and maybe some others), it looks
> >    to be a very well-done module, and I (to repeat myself) would like to
> >    see it as part of the default Apache package.
> 
> Thanks! I will do my best to add the requested changes and provide as fast as
> I can mod_rewrite v2.1 which should fit better to your requests.  If you
> change something yourself, please send the changes to me, too. I want to
> support mod_rewrite in the future, too.

Great. Thanks!

-- Alexei Kosut <akosut@organic.com>            The Apache HTTP Server 
   http://www.nueva.pvt.k12.ca.us/~akosut/      http://www.apache.org/


Mime
View raw message