You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tofu Optimist <to...@yahoo.com> on 2003/09/02 17:43:31 UTC

post max and MP2

Hello -- 

I'm moving a module from MP1 to MP2.
What is the MP2 equivalent of this code?	
Thanks!

<code>
my $q = Apache::Request->new($r,
	POST_MAX => 10 * 1024,  
	DISABLE_UPLOADS => 1);      
$q->no_cache(1);                
</code>

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: self_url MP2 w/o CGI

Posted by Stas Bekman <st...@stason.org>.
Tofu Optimist wrote:
> Thanks.  How do I call construct_uri?

You just call $r->construct_url. In your example that would be:

    $r->headers_out->set(Location => $r->construct_url . "&r2=1");

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: self_url MP2 w/o CGI

Posted by Tofu Optimist <to...@yahoo.com>.
Thanks.  How do I call construct_uri?

Neither

        my $uri = APR::URI->parse($r->pool,
$r->construct_url($r->pool, $r->uri, $r));
       $uri .= "r2=1";
        $r->headers_out->set(Location => $uri .
"&r2=1");
        return Apache::REDIRECT;


nor

        my $uri = APR::URI->parse($r->pool,
$r->construct_url);
       $uri .= "r2=1";
        $r->headers_out->set(Location => $uri .
"&r2=1");
        return Apache::REDIRECT;

works.

Thanks Stas for all your patience and help!



--- Stas Bekman <st...@stason.org> wrote:
> Tofu Optimist wrote:
> > Hi folks --
> > 
> > I'm using MP2, and I am trying to avoid loading
> CGI
> > for 2 reasons: 
> > 
> > (1) To save memory. 
> > 
> > (2) When I do load CGI, it fails at the "require
> > Apache" (line 161), and I'd prefer not to edit CGI
> on
> > my server.  Uck.
> > 
> > Given I'm not loading CGI, how can I determine
> > self_url() in MP2?
> > 
> > I tried something like this
> > <code>
> >         my $self_uri = APR::URI->parse($r->pool,
> > $r->uri)->unparse;
> >         $r->headers_out->set(Location => $self_uri
> .
> > "&r2=1");
> >         return Apache::REDIRECT;
> > </code>
> > but this gives me a partial URL, not the full
> > expansion.
> 
> $r->construct_url;
> 
>  From the C docs:
> 
> /* Used for constructing self-referencing URLs, and
> things like SERVER_PORT,
>   * and SERVER_NAME.
>   */
> /**
>   * build a fully qualified URL from the uri and
> information in the request rec
>   * @param p The pool to allocate the URL from
>   * @param uri The path to the requested file
>   * @param r The current request
>   * @return A fully qualified URL
>   * @deffunc char *ap_construct_url(apr_pool_t *p,
> const char *uri, 
> request_rec *r)
>   */
> AP_DECLARE(char *) ap_construct_url(apr_pool_t *p,
> const char *uri, 
> request_rec *r);
> 
>
__________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another
> mod_perl Hacker
> http://stason.org/     mod_perl Guide --->
> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org
> http://apacheweek.com
> http://modperlbook.org http://apache.org  
> http://ticketmaster.com
> 
> 
> 
> -- 
> Reporting bugs: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: self_url MP2 w/o CGI

Posted by Stas Bekman <st...@stason.org>.
Tofu Optimist wrote:
> Hi folks --
> 
> I'm using MP2, and I am trying to avoid loading CGI
> for 2 reasons: 
> 
> (1) To save memory. 
> 
> (2) When I do load CGI, it fails at the "require
> Apache" (line 161), and I'd prefer not to edit CGI on
> my server.  Uck.
> 
> Given I'm not loading CGI, how can I determine
> self_url() in MP2?
> 
> I tried something like this
> <code>
>         my $self_uri = APR::URI->parse($r->pool,
> $r->uri)->unparse;
>         $r->headers_out->set(Location => $self_uri .
> "&r2=1");
>         return Apache::REDIRECT;
> </code>
> but this gives me a partial URL, not the full
> expansion.

$r->construct_url;

 From the C docs:

/* Used for constructing self-referencing URLs, and things like SERVER_PORT,
  * and SERVER_NAME.
  */
/**
  * build a fully qualified URL from the uri and information in the request rec
  * @param p The pool to allocate the URL from
  * @param uri The path to the requested file
  * @param r The current request
  * @return A fully qualified URL
  * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, 
request_rec *r)
  */
AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, 
request_rec *r);

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


self_url MP2 w/o CGI

Posted by Tofu Optimist <to...@yahoo.com>.
Hi folks --

I'm using MP2, and I am trying to avoid loading CGI
for 2 reasons: 

(1) To save memory. 

(2) When I do load CGI, it fails at the "require
Apache" (line 161), and I'd prefer not to edit CGI on
my server.  Uck.

Given I'm not loading CGI, how can I determine
self_url() in MP2?

I tried something like this
<code>
        my $self_uri = APR::URI->parse($r->pool,
$r->uri)->unparse;
        $r->headers_out->set(Location => $self_uri .
"&r2=1");
        return Apache::REDIRECT;
</code>
but this gives me a partial URL, not the full
expansion.

Thanks for any assistance.

-TO


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: post max and MP2

Posted by Issac Goldstand <ma...@beamartyr.net>.
Right now Apache::Request is in the final proting stages... Until it's done,
jjust request Apache::Request with CGI

  Issac

----- Original Message ----- 
From: "Tofu Optimist" <to...@yahoo.com>
To: <mo...@perl.apache.org>
Sent: Tuesday, September 02, 2003 6:43 PM
Subject: post max and MP2


> Hello -- 
>
> I'm moving a module from MP1 to MP2.
> What is the MP2 equivalent of this code?
> Thanks!
>
> <code>
> my $q = Apache::Request->new($r,
> POST_MAX => 10 * 1024,
> DISABLE_UPLOADS => 1);
> $q->no_cache(1);
> </code>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
>
> -- 
> Reporting bugs: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
>




-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html