form upload limit

2001-12-13 Thread Viljo Marrandi

Hello,

I didn't find anywhere in Net how much is browser form upload limit
(with POST) and how much is Apache's default form data access(input)
limit. If anyone knows where I can find this data i'd be grateful.

I tested this form upload with large text and in my case only 64K went
thru (ended up in MySQL). I saw in Apache homepage, that I could define
POST_MAX like this:

   my $apr = Apache::Request-new($r, POST_MAX = 1024);

Err, is this 1024 bytes or kbytes?

(OT - Perl basics question) Right now I define $apr this way:

$apr = Apache::Request-new( $r-is_main ? $r : $r-main );

Now how I tell $apr that its POST_MAX = 1024?

Rgds,
Viljo



Re: form upload limit

2001-12-13 Thread Stas Bekman

Viljo Marrandi wrote:

 Hello,
 
 I didn't find anywhere in Net how much is browser form upload limit
 (with POST) and how much is Apache's default form data access(input)
 limit. If anyone knows where I can find this data i'd be grateful.


There is no such a limit in Apache and probably most browsers. The limit 
can be the amount of available RAM (if the file is aggregated in the 
memory) or the filesystem limits (not enough disk space, if the uploaded 
file is created on the filesystem). You can limit it within your code, 
though.


 I tested this form upload with large text and in my case only 64K went
 thru (ended up in MySQL). I saw in Apache homepage, that I could define
 POST_MAX like this:
 
my $apr = Apache::Request-new($r, POST_MAX = 1024);
 
 Err, is this 1024 bytes or kbytes?


Since CGI.pm is the base of Apache::Request (but written in Perl, 
whereas Apache::Request is written mostly in C), parts of CGI.pm's 
extensive documentation will apply for Apache::Request as well.

So if you look at CGI.pm's manpage you will see that it's in bytes:

$CGI::POST_MAX
If set to a non-negative integer, this variable puts a
ceiling on the size of POSTings, in *bytes*.

If CGI.pm
detects a POST that is greater than the ceiling, it
will immediately exit with an error message.  This
value will affect both ordinary POSTs and multipart
POSTs, meaning that it limits the maximum size of file
uploads as well.  You should set this to a reasonably
high value, such as 1 megabyte.

You are welcome to send the documentation patches to the developers of 
the Apache::Request package at [EMAIL PROTECTED] This kind of 
contribution helps a lot.


 (OT - Perl basics question) Right now I define $apr this way:
 
 $apr = Apache::Request-new( $r-is_main ? $r : $r-main );
 
 Now how I tell $apr that its POST_MAX = 1024?


either:

my $real_r = $r-is_main ? $r : $r-main;
my $apr = Apache::Request-new($real_r, POST_MAX = 1024);

or

$apr = Apache::Request-new( ($r-is_main ? $r : $r-main),
  POST_MAX = 1024 );


_
Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




Re: form upload limit

2001-12-13 Thread Monika

 I didn't find anywhere in Net how much is browser form upload limit
 (with POST) and how much is Apache's default form data access(input)
 limit. If anyone knows where I can find this data i'd be grateful.

Apache's default is 75 and it's under the directive 
LimitRequestBody 75

From my expirience, it is the lower boud of the size limit (that is Apache
size limit seems to overwrite size limit from POST_MAX)

As far as POST_MAX... I was using CGI::POST_MAX=1024*100, which would set the
max size to 100 kb.
It's also defind in CGI.pm

hope this helps,
Monika

 
 I tested this form upload with large text and in my case only 64K went
 thru (ended up in MySQL). I saw in Apache homepage, that I could define
 POST_MAX like this:
 
my $apr = Apache::Request-new($r, POST_MAX = 1024);
 
 Err, is this 1024 bytes or kbytes?
 
 (OT - Perl basics question) Right now I define $apr this way:
 
 $apr = Apache::Request-new( $r-is_main ? $r : $r-main );
 
 Now how I tell $apr that its POST_MAX = 1024?
 
 Rgds,
 Viljo
 




Re: form upload limit

2001-12-13 Thread Rob Nagler

 There is no such a limit in Apache and probably most browsers.

By default, LimitRequestBody is 0 (unlimited) in Apache.  We limit
incoming requests with this directive, so server resources aren't
consumed by excessive.  I think POST_MAX happens after the request is
already read into memory.

LimitXMLRequestBody has a default limit of 100.  There are other
LimitRequest* directives which limit various aspects of the header.

Rob



Re: form upload limit

2001-12-13 Thread Igor Sysoev

On Thu, 13 Dec 2001, Stas Bekman wrote:

 Viljo Marrandi wrote:
 
  Hello,
  
  I didn't find anywhere in Net how much is browser form upload limit
  (with POST) and how much is Apache's default form data access(input)
  limit. If anyone knows where I can find this data i'd be grateful.
 
 
 There is no such a limit in Apache and probably most browsers. The limit 
 can be the amount of available RAM (if the file is aggregated in the 
 memory) or the filesystem limits (not enough disk space, if the uploaded 
 file is created on the filesystem). You can limit it within your code, 
 though.

About one third requests going through proxies.
And about 70% of proxies are Squids.
And nearly all Squids has default upload limit of 1M.

Igor Sysoev




Re: form upload limit

2001-12-13 Thread darren chamberlain

Joe Schaefer [EMAIL PROTECTED] said something to this effect on 12/13/2001:
 Is this what you want
 
   $apr = Apache::Request-new( $r-is_main ? $r : $r-main, 
POST_MAX = 1024);
 
 ?  I don't think Apache::Request provides any Perl methods for
 culling the post_max setting from a $apr;  you'd either have to
 write some XS for that, keep track of it yourself, or lobby for
 a new feature ;)

Or you can patch libapreq-0.33/Request/Request.xs:

*** Request.xs.orig Thu Dec 13 11:44:25 2001
--- Request.xs  Thu Dec 13 11:36:06 2001
***
*** 356,361 
--- 356,375 
  Apache::Request req
  
  int
+ ApacheRequest_post_max(req, max=Nullsv)
+ Apache::Request req
+ SV *max;
+ 
+ CODE:
+ if (max != Nullsv) {
+   req-post_max = (int)SvIV(max);
+ }
+ RETVAL = req-post_max;
+ 
+ OUTPUT:
+ RETVAL
+ 
+ int
  ApacheRequest_parse(req)
  Apache::Request req

This will add $apr-post_max, which works in my (simplistic and
deterministic) tests.

(darren)

-- 
If I worked as much as others I would do as little as they.