in reply to CGI upload limit
Nice question, Ryszard.
I would subclass CGI::Application and reimplement the query method:
sub query { my $self = shift; my ($query) = @_; # We're only allowed to set a new query object if one does not yet e +xist! unless (exists($self->{__QUERY_OBJ})) { my $new_query_obj; # If data is provided, set it! Otherwise, create a new one. if (defined($query) && $query->isa('CGI')) { $new_query_obj = $query; } else { $CGI::POST_MAX=1024 * 100; # max 100K posts $new_query_obj = CGI->new(); } $self->{__QUERY_OBJ} = $new_query_obj; } return $self->{__QUERY_OBJ}; }
Beware, the code isn't tested. The new method could also use a parameter passed during start up:
my $webapp = App->new( TMPL_PATH => 'App/', PARAMS => { 'max_upload_size' => 100 } );
Then you could check this parameter and act accordingly
inside your reimplemented method. Another solution could be
creating a new CGI object (with POST_MAX set properly) and
passing it to application init; C::A will recognize the object
and use it; here is an excerpt from the man page:
QUERY - This optional parameter allows you to specify an already-created CGI.pm query object. Under normal use, CGI::Application will instantiate its own CGI.pm query object. Under certain conditions, it might be useful to be able to use one which has already been created.
Hope this helps. Ciao, Valerio
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: CGI upload limit
by samtregar (Abbot) on Sep 15, 2002 at 07:28 UTC |