You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Roman Vašíček <rv...@petamem.com> on 2004/11/30 17:42:05 UTC
Apache2+mod_perl2+Mason - limit upload size
Hi all,
I want to limit upload size on my Apache2+Mason powered website depending
to user category - eg: guest = 500kB, registered = 2MB, admin = 10 MB. I
already found answered question on perlmonks.org
http://www.perlmonks.org/index.pl?node_id=328687
but described solution seems to does not work with Apache2. Using presented
code I get 500 error from server with message
Can't call method "comp" on an undefined value
for the line
$m->comp('/lib/component');
Probably $m is not properly initialized...
Currently I'm trying to use 'LimitRequestBody' in Apache configuration, but
don't know how can I handle errors in my Mason code in case of this limit
exceeds. Folowing code does not work
if ($r->status == 413) {
warn "Limit reached";
$m->print(qq(<p>Data volume exceeds the capacity limit</p>));
$r->status(200);
return;
}
It seems to work - status is set correctly if I test it in component, but browser
still get 413 response instead of 200 and generated HTML code have prepended
error message generated by Apache(?).
Versions used:
Apache2 - 2.0.48
libapreq2 - 2.03_dev
mod_perl - 1.99_14
HTML::Mason - 1.26
MasonX::Apache2Handler - 0.05
MasonX::Request::WithApache2Session - 0.04
Apache::Session - 1.54
Thanks
Roman
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Apache2+mod_perl2+Mason - limit upload size
Posted by Cure <cu...@cureable.com>.
I would upgrade HTML::Mason.
1.27 October 28, 2004
ENHANCEMENTS
* Full support for Apache2/mod_perl2.
Roman Vas(�c(ek wrote:
>Hi all,
> I want to limit upload size on my Apache2+Mason powered website depending
>to user category - eg: guest = 500kB, registered = 2MB, admin = 10 MB. I
>already found answered question on perlmonks.org
>
> http://www.perlmonks.org/index.pl?node_id=328687
>
>but described solution seems to does not work with Apache2. Using presented
>code I get 500 error from server with message
>
> Can't call method "comp" on an undefined value
>
>for the line
>
> $m->comp('/lib/component');
>
>Probably $m is not properly initialized...
>
>Currently I'm trying to use 'LimitRequestBody' in Apache configuration, but
>don't know how can I handle errors in my Mason code in case of this limit
>exceeds. Folowing code does not work
>
>if ($r->status == 413) {
> warn "Limit reached";
> $m->print(qq(<p>Data volume exceeds the capacity limit</p>));
> $r->status(200);
> return;
>}
>
>
>It seems to work - status is set correctly if I test it in component, but browser
>still get 413 response instead of 200 and generated HTML code have prepended
>error message generated by Apache(?).
>
>Versions used:
> Apache2 - 2.0.48
> libapreq2 - 2.03_dev
> mod_perl - 1.99_14
> HTML::Mason - 1.26
> MasonX::Apache2Handler - 0.05
> MasonX::Request::WithApache2Session - 0.04
> Apache::Session - 1.54
>
>
> Thanks
> Roman
>
>
>