Re: Apache2+mod_perl2+Mason - limit upload size

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

From: Cure
Subject: Re: Apache2+mod_perl2+Mason - limit upload size
Date: 17:47 on 30 Nov 2004
--------------030706050108080404020903
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

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
>
>  
>

--------------030706050108080404020903
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
I would upgrade HTML::Mason.<br>
<br>
<p><a name="v1.27"></a><b>1.27 October 28, 2004</b>
</p>
<ul>
  <h5>ENHANCEMENTS</h5>
  <li>Full support for Apache2/mod_perl2. </li>
</ul>
<br>
<br>
Roman Va&#353;&iacute;&#269;ek wrote:<br>
<blockquote type="cite" cite="mid20041130174205.C29035@xxxxxxx.xxx">
  <pre wrap="">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

        <a class="moz-txt-link-freetext" href="http://www.perlmonks.org/index.pl?node_id=328687">http://www.perlmonks.org/index.pl?node_id=328687</a>;

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-&gt;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-&gt;status == 413) {
  warn "Limit reached";
  $m-&gt;print(qq(&lt;p&gt;Data volume exceeds the capacity limit&lt;/p&gt;));
  $r-&gt;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

  </pre>
</blockquote>
</body>
</html>

--------------030706050108080404020903--

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

Re: Apache2+mod_perl2+Mason - limit upload size
Cure 17:47 on 30 Nov 2004

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