Implemented it in C:

  if (f->r->status==HTTP_NOT_FOUND) // If this is so, we need to revamp the
request_rec
  {
   f->r->status=HTTP_OK; // Spoof HTTP_OK
   f->r->status_line="200 OK";

APR_BRIGADE_INSERT_TAIL(ctx->bb,apr_bucket_eos_create(f->c->bucket_alloc));
// Add an EOS to the new bb
   ap_pass_brigade(f->next,ctx->bb); // and pass the new bb to the next
filter
   return APR_SUCCESS;
  }

Not sure how to translate that to mod_perl's API (the first half is easy and
understandable in C, I think, though...)

This was *my* solution - I'm not sure if it's the "best way to do it"...
I'm sure that as I delve deeper into Apache 2, I'll find better solutions...

  Issac

----- Original Message -----
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Issac Goldstand" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 3:43 PM
Subject: Re: [MP2] Handler feauters in a filter?


> Issac Goldstand wrote:
> > I'm writing a filter in which two lines of data are to be appended to
the
> > content going back.  However, I'd like to test for a 404, and if found
set
> > the response to 200.  Can this be done from the output filters?  Or am I
> > going to have to do something more complex with a handler?
>
> Haven't tried this yet, but you can either write a connection filter
> which rewrites the headers if they were sent already, or insert your
> filter just before the one that generates the headers. Since you want to
> add something to the end, the former case is probably the best. I
> suggest that you ask for the best way at the httpd-dev list, as it's a
> pretty generic httpd topic and that list has real filter experts. Then
> once you figure out from them what's the best way to go (and share with
> us :) implementing it in perl is a piece of cake.
>
> > The big problem is mod_proxy (or any other module, for that matter) -
it's
> > not as simple as checking the file on disk - the content could be coming
> > from a proxy or from another content-handler.
> >
> > Any ideas?
> >   Issac
>
>
> --
>
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>

Reply via email to