You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Hibbard, Timothy" <hi...@ohio.edu> on 2011/01/25 19:23:45 UTC

Uploading Files bigger the 64M

I am having all sorts of troubles uploading files bigger then 64M using mod_perl2.

Any file I try to upload that is bigger then 63M I get the following error.

(20014)Internal error: Content-Length header (723283299) exceeds configured max_body limit (67108864)

So I told myself lets do a little research .... It is Perl so this should be easy to fix.  After a little of researching I found the APREQ2_ReadLimit parameter for the httpd.conf.  So I added this to my httpd.conf.

APREQ2_ReadLimit 1024M (1 Gig)

Restarted Apache and tried again .... Still no luck with same error message.  Back to researching.

I found 2 more things which I thought would solve my problem.  I found POST_MAX:

my $req = Apache2::Request->new($r,POST_MAX =>100 * 1024 * 1024);

And also

$req->read_limit(100 * 1024 * 1024);

So I tried playing with these settings and all I get now is "Conflicting information" in my log files.  As soon as I set POST_MAX or read_limit to anything below 67108864 it works fine for all files less then 64M in size.  How can I get mod_perl2 to upload a 700mb file.  If you need sample code of what I am doing I am more then happy to provide it.

Thanks in advance,

Tim Hibbard
Senior Program Engineer
Ohio University
Athens, Ohio 457-1

Re: Uploading Files bigger the 64M

Posted by "Hibbard, Timothy" <hi...@ohio.edu>.
Worked like a charm.  I had APREQ_ReadLimit in a vhost ... Once moving it out of the vhost I can now upload bigger files.  Should have used the mailing list before making an indentation in the brick wall with my forehead.

Many thanks!

Tim Hibbard


On 1/25/11 1:31 PM, "Joe Schaefer" <jo...@yahoo.com> wrote:

It's a bug in the merge code for mod_apreq2.  Basically
you have to set APREQ_ReadLimit to its max value
in the main server's context (not in a vhost or Location
or Directory config).

Otherwise use the code in apreq's trunk.


From: "Hibbard, Timothy" <hi...@ohio.edu>
To: "modperl@perl.apache.org" <mo...@perl.apache.org>
Sent: Tue, January 25, 2011 1:23:45 PM
Subject: Uploading Files bigger the 64M

Uploading Files bigger the 64M I am having all sorts of troubles uploading files bigger then 64M using mod_perl2.

Any file I try to upload that is bigger then 63M I get the following error.

(20014)Internal error: Content-Length header (723283299) exceeds configured max_body limit (67108864)

So I told myself lets do a little research .... It is Perl so this should be easy to fix.  After a little of researching I found the APREQ2_ReadLimit parameter for the httpd.conf.  So I added this to my httpd.conf.

APREQ2_ReadLimit 1024M (1 Gig)

Restarted Apache and tried again .... Still no luck with same error message.  Back to researching.

I found 2 more things which I thought would solve my problem.  I found POST_MAX:

my $req = Apache2::Request->new($r,POST_MAX =>100 * 1024 * 1024);

And also

$req->read_limit(100 * 1024 * 1024);

So I tried playing with these settings and all I get now is "Conflicting information" in my log files.  As soon as I set POST_MAX or read_limit to anything below 67108864 it works fine for all files less then 64M in size.  How can I get mod_perl2 to upload a 700mb file.  If you need sample code of what I am doing I am more then happy to provide it.

Thanks in advance,

Tim Hibbard
Senior Program Engineer
Ohio University
Athens, Ohio 457-1



Re: Uploading Files bigger the 64M

Posted by Joe Schaefer <jo...@yahoo.com>.
It's a bug in the merge code for mod_apreq2.  Basically
you have to set APREQ_ReadLimit to its max value
in the main server's context (not in a vhost or Location
or Directory config).

Otherwise use the code in apreq's trunk.



>
>From: "Hibbard, Timothy" <hi...@ohio.edu>
>To: "modperl@perl.apache.org" <mo...@perl.apache.org>
>Sent: Tue, January 25, 2011 1:23:45 PM
>Subject: Uploading Files bigger the 64M
>
>Uploading Files bigger the 64M I am having all sorts of troubles uploading files 
>bigger then 64M using mod_perl2.
>
>Any file I try to upload that is bigger then 63M I get the following error.
>
>(20014)Internal error: Content-Length header (723283299) exceeds configured 
>max_body limit (67108864)
>
>So I told myself lets do a little research .... It is Perl so this should be 
>easy to fix.  After a little of researching I found the APREQ2_ReadLimit 
>parameter for the httpd.conf.  So I added this to my httpd.conf.
>
>APREQ2_ReadLimit 1024M (1 Gig)
>
>Restarted Apache and tried again .... Still no luck with same error message. 
> Back to researching.
>
>I found 2 more things which I thought would solve my problem.  I found 
POST_MAX:
>
>my $req = Apache2::Request->new($r,POST_MAX =>100 * 1024 * 1024);
>
>And also
>
>$req->read_limit(100 * 1024 * 1024);
>
>So I tried playing with these settings and all I get now is “Conflicting 
>information” in my log files.  As soon as I set POST_MAX or read_limit to 
>anything below 67108864 it works fine for all files less then 64M in size.  How 
>can I get mod_perl2 to upload a 700mb file.  If you need sample code of what I 
>am doing I am more then happy to provide it.
>
>Thanks in advance,
>
>Tim Hibbard
>Senior Program Engineer
>Ohio University
>Athens, Ohio 457-1 


      

Re: Uploading Files bigger the 64M

Posted by Ryan Gies <ry...@livesite.net>.
1) You may lower the limit, not raise it.  If you are trying to raise 
it, you will get "Conflicting information".

2) Your server config trumps your virtual-host config.  If you have not 
set APREQ2_ReadLimit outside of your VirtualHost, then it is set for you 
(64M).

Personally, I do this:

A) Set APREQ2_ReadLimit in /etc/httpd/conf.d/apreq.conf to the largest 
value I would allow for any virtual host.

B) Set APREQ2_ReadLimit to the largest upload value appropriate for the 
client inside their VirtualHost container.

C) Set $req->read_limit inside a PerlResponseHandler depending on the 
logical type of request:

   # The Apache request library only allows lowering the read limit 
(POST_MAX).
   # The default is 64M (64 * 1024 * 1024) so if larger uploads are 
desired, one
   # must raise the limit by setting APREQ2_ReadLimit in the Apache 
configuration.
   # When using VirtualHosts, the larger limit *must* be specified in 
server
   # configuration, and then optionally reduced in the vhost config.
   # http://marc.info/?l=apreq-dev&m=115829354028472&w=2
   my $limit = $req->read_limit();
   my $max = $rr->max_post_size; # the max post size allowed for the 
current request
   if ($max > $limit) {
     $Log->warn(sprintf('Cannot raise read_limit from %d to %d', $limit, 
$max));
   } else {
     $req->read_limit($max) or die $!;
     $limit = $req->read_limit();
     $Log->error('Error setting read_limit') unless $limit == $max;
   }



On 01/25/2011 01:23 PM, Hibbard, Timothy wrote:
> I am having all sorts of troubles uploading files bigger then 64M 
> using mod_perl2.
>
> Any file I try to upload that is bigger then 63M I get the following 
> error.
>
> (20014)Internal error: Content-Length header (723283299) exceeds 
> configured max_body limit (67108864)
>
> So I told myself lets do a little research .... It is Perl so this 
> should be easy to fix.  After a little of researching I found the 
> APREQ2_ReadLimit parameter for the httpd.conf.  So I added this to my 
> httpd.conf.
>
> APREQ2_ReadLimit 1024M (1 Gig)
>
> Restarted Apache and tried again .... Still no luck with same error 
> message.  Back to researching.
>
> I found 2 more things which I thought would solve my problem.  I found 
> POST_MAX:
>
> my $req = Apache2::Request->new($r,POST_MAX =>100 * 1024 * 1024);
>
> And also
>
> $req->read_limit(100 * 1024 * 1024);
>
> So I tried playing with these settings and all I get now is 
> "Conflicting information" in my log files.  As soon as I set POST_MAX 
> or read_limit to anything below 67108864 it works fine for all files 
> less then 64M in size.  How can I get mod_perl2 to upload a 700mb 
> file.  If you need sample code of what I am doing I am more then happy 
> to provide it.
>
> Thanks in advance,
>
> Tim Hibbard
> Senior Program Engineer
> Ohio University
> Athens, Ohio 457-1