You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yuriy Pasichnyk <yu...@hotmail.com> on 2003/01/19 14:33:00 UTC

Need your advice about proper design of input and output filters

Dear Sirs,

I am extensively using mod_dav module. And very often there is
a need to modify WebDAV/HTTP request and response.

Example:
1. User requests resource by the following URL: '/resource'
2. I have to modify the URL as the following: '/{username}/resource'
3. As you can see what has to be done seems like something for mod_rewrite,
   but the problem is that the same modification is needed for headers and 
body
   of a request as well (something that mod_rewrite doesn't do).
4. Request is pocessed by a content handler
5. Now we have to do similar modifications with response (headers and body)

I think that the problem is quite generic so instead of hacking/modifying
mod_dav I was thinking of writing separate apache module/filter that can be
reused by other people as well.

So, as it appears to me, I have the following options:
1. Write handler (let's say fixup_handler or url_translate_name_handler) 
that
   will intercept and modify a request, but I cannot use anything like that 
for
   modifying response (as I understand for that matter I have to use filters 
only,
   unless content handler is mod_perl perl handler that is written with 
chaining
   requests in mind). I don't think that combining handler and filter is
   elegant solution.
2. Write request input and output filters (the problem here is - access to
   URL and headers of request and response)
3. WRite connection input and output filters (the problem here is - 
subrequest.
   I need to know user name during the modification process. To discover the 
user
   name I need to issue subrequest. If I had request_rec in hands that the 
issueing
   subrequest wouldn't be a problem. But how do I do it in connection filter 
?)

So, if you were so kind to express your ideas I whould highly appreciate it.


Thanks in advance,

Yuriy







_________________________________________________________________
The new MSN 8 is here: Try it free* for 2 months 
http://join.msn.com/?page=dept/dialup


Re: Need your advice about proper design of input and output filters

Posted by Justin Erenkrantz <je...@apache.org>.
--On Sunday, January 19, 2003 2:33 PM +0100 Yuriy Pasichnyk 
<yu...@hotmail.com> wrote:

> I think that the problem is quite generic so instead of
> hacking/modifying mod_dav I was thinking of writing separate apache
> module/filter that can be reused by other people as well.

Yeah, WebDAV has a slight architectural problem in that there is 
resource metadata in the body.  It'd be much nicer if it could 
constrain itself to only the header rather than the body.  That would 
make it far easier for proxies to deal with WebDAV.  Alas...

Regardless, you might want to take a look at an extension to the 
httpd module for Subversion (mod_dav_svn) that does the rewriting for 
DAV requests on-the-fly using filters.

http://svn.collab.net/repos/svn/branches/dav-mirror/subversion/mod_da
v_svn/

In particular, look at the filters in mod_dav_svn.  It'll tell you 
how one particular person thought it should work.  It'd be nice to 
make that more general, but there's always other things to do.  -- 
justin