Apache2+mod_perl2+Mason - limit upload size

[prev] [thread] [next] [Date index for 2004/11/30]

From: Roman =?iso-8859-2?B?VmG57ehlaw==?=
Subject: Apache2+mod_perl2+Mason - limit upload size
Date: 16:42 on 30 Nov 2004
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

Apache2+mod_perl2+Mason - limit upload size
Roman =?iso-8859-2?B?VmG57ehlaw==?= 16:42 on 30 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52