Re: autoflush behavior for subrequests

Dave Rolsky <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Thu, 16 Sep 2004, Jonathan Swartz wrote:

> In my experience, most people use subrequests for "internal redirects",
> and this is how they expect (or would like) them to work:

Where "most must not be me".  I've never done this.

> 1. Any current contents of the parent buffer are cleared.
> 2. The out_method of the subrequest is the same as the out_method of the
> parent.
> 3. autoflush or manual flush_buffers take effect immediately.
> 4. If the subrequest returns successfully, the parent aborts (so as not
> to generate any more output) with the return value (if any) of the
> subrequest.
> 5. If the subrequest aborts, the parent aborts with the aborted value.
> 6. If the subrequest dies with an error, the error gets handled in the
> same way as if the parent had generated it.
>
> Perhaps we should have a $m->internal_redirect() that uses $m->subexec()
> underneath but guarantees the above behavior.

That sounds like a reasonable idea.  I certainly would want to change
subexec to implement the above, since that'd break lots of code.

> Other people try to use subrequests as mere glorified component calls
> with dhandlers and autohandlers turned on. (This seems rarer because,
> for one thing, you've got to deal with the double content wrapping
> problem.) Because this use case is less frequent, we don't have to worry
> as much about the default subrequest behavior supporting it.

This is the _only_ way I've ever used this feature!  It's handy sometimes
to have bits of library code which share an autohandler, but are not
top-level components.

Honestly I don't see the point of internal redirects.  If I want a
redirect I'll issue one.  IMO one a given URI should always point to the
same page.  Internal redirects (Apache or otherwise) break that.


-dave

/*===========================
VegGuide.Org
Your guide to all that's veg.
===========================*/


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.