Return-Path: Mailing-List: contact apreq-dev-help@httpd.apache.org; run by ezmlm Delivered-To: mailing list apreq-dev@httpd.apache.org Received: (qmail 81396 invoked from network); 19 Dec 2000 09:00:00 -0000 Received: from mailgate.sergeant.org (HELO mail.sergeant.org) (qmailr@194.70.26.133) by locus.apache.org with SMTP; 19 Dec 2000 09:00:00 -0000 Received: (qmail 1643 invoked by uid 501); 19 Dec 2000 09:00:00 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 19 Dec 2000 09:00:00 -0000 Date: Tue, 19 Dec 2000 09:00:00 +0000 (GMT) From: Matt Sergeant To: Jim Winstead cc: Subject: Re: Request singleton In-Reply-To: <20001218171712.A7595@trainedmonkey.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N On Mon, 18 Dec 2000, Jim Winstead wrote: > you forgot the part of the patch that updates the documentation. :) > > (this also doesn't allow setting POST_MAX or DISABLE_UPLOADS. and > what happens on a subrequest?) OK, new patch: Index: Request/Request.pm =================================================================== RCS file: /home/cvs/httpd-apreq/Request/Request.pm,v retrieving revision 1.9 diff -r1.9 Request.pm 28a29,39 > sub instance { > my $class = shift; > my $r = shift; > if (my $apreq = $r->pnotes('apreq')) { > return $apreq; > } > my $new_req = $class->new($r, @_); > $r->pnotes('apreq', $new_req); > return $new_req; > } > 92a104,129 > > =item instance > > The instance() class method allows Apache::Request to be a singleton. > This means that whenever you call Apache::Request->instance() within a > single request you always get the same Apache::Request object back. > This solves the problem with creating the Apache::Request object twice > within the same request - the symptoms being that the second > Apache::Request object will not contain the form parameters because > they have already been read and parsed. > > my $apr = Apache::Request->instance($r, DISABLE_UPLOADS => 1); > > Note that C call will take the same parameters as the above > call to C, however the parameters will only have an effect the > first time C is called within a single request. Extra > parameters will be ignored on subsequent calls to C within > the same request. > > Subrequests receive a new Apache::Request object when they call > instance() - the parent request's Apache::Request object is not copied > into the subrequest. > > Also note that it is unwise to use the C method when using > C because you may end up trying to call it twice, and > detecting errors where there are none. -- /|| ** Director and CTO ** //|| ** AxKit.com Ltd ** ** XML Application Serving ** // || ** http://axkit.org ** ** XSLT, XPathScript, XSP ** // \\| // ** Personal Web Site: http://sergeant.org/ ** \\// //\\ // \\