Re: Uploading Files bigger the 64M

Ryan Gies <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Organization Livesite Networks, LLC
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.