in reply to Re: Re: Mason upload limit size
in thread Mason upload limit size

No, you can vary the limit but you just have to make your My::ApacheHandler a little bit fancier.

package My::ApacheHandler; use base 'HTML::Mason::ApacheHandler'; sub prepare_request { my $self = shift; my $r = shift; my @args; ## <Location /foo> ## PerlSetVar MAH_POST_MAX 1024 ## </Location> ## <Location /bar> ## PerlSetVar MAH_POST_MAX none ## </Location> my $post_max = $r->dir_config( 'MAH_POST_MAX' ); unless( $post_max =~ /^none/ ) { push @args, POST_MAX => $post_max; } Apache::Request->instance( $r, @args ); return $self->SUPER::prepare_request( $r, @_ ); } 1;

Replies are listed 'Best First'.
Re: Re: Re: Re: Mason upload limit size
by physi (Friar) on Feb 13, 2004 at 23:22 UTC
    Just checked this out...

    works perfect!

    Thanks ++

    btw: maybe it's worth to implement this in Mason's src!?

    -----------------------------------
    --the good, the bad and the physi--
    -----------------------------------
    
Apache2 problem
by ph0enix (Friar) on Nov 29, 2004 at 16:10 UTC

    How can be this code adopted for Apache2? I'm using Apache2 together with Mason and session (MasonX::Apache2Handler as response handler and MasonX::Request::WithApache2Session as request class) and need to limit uploads too.

    Trying to use described solution I get in most cases 500 response (Internal server error). It seems $m to be undefined :-(

Re^4: Mason upload limit size
by Savuud (Initiate) on Apr 06, 2005 at 13:24 UTC
    When I tried to implement your code to do this, I get the following error: Can't locate object method "pnotes" via package "POST_MAX" (perhaps you forgot to load "POST_MAX"?)
    package MyApacheHandler; use base 'HTML::Mason::ApacheHandler'; sub prepare_request { my $self = shift; my $r = shift; my $post_max = 100; Apache::Request->instance( $r, POST_MAX => $post_max ); return $self->SUPER::prepare_request( $r, @_ ); } 1;
    In the autohandler
    <%init> use MyApacheHandler; my $apr = MyApacheHandler::prepare_request($r,POST_MAX => 1); </%init>
    Any idea why I get this error?

    Update: This is a newbie error and I solved it myself :)