Support for post size limiting.
This commit is contained in:
parent
904704e0ee
commit
ba6b7d01b2
@ -85,6 +85,8 @@ BEGIN {
|
|||||||
# in this module is called with a hash of arguments containing the database handle,
|
# in this module is called with a hash of arguments containing the database handle,
|
||||||
# cgi object, settings, session handler, template handler, and module loader.
|
# cgi object, settings, session handler, template handler, and module loader.
|
||||||
# - `upload_hook`, an optional reference to a function to use as a CGI upload hook.
|
# - `upload_hook`, an optional reference to a function to use as a CGI upload hook.
|
||||||
|
# - `post_max`, the maximum size of uploaded data in MB. If not set, the default is to
|
||||||
|
# limit posts to 128MB.
|
||||||
#
|
#
|
||||||
# @param args A hash of arguments to initialise the Application object with.
|
# @param args A hash of arguments to initialise the Application object with.
|
||||||
# @return A new Application object.
|
# @return A new Application object.
|
||||||
@ -92,8 +94,9 @@ sub new {
|
|||||||
my $invocant = shift;
|
my $invocant = shift;
|
||||||
my $class = ref($invocant) || $invocant;
|
my $class = ref($invocant) || $invocant;
|
||||||
my $self = {
|
my $self = {
|
||||||
config => "config/site.cfg",
|
config => "config/site.cfg",
|
||||||
use_phpbb => 0,
|
use_phpbb => 0,
|
||||||
|
post_max => 128,
|
||||||
@_,
|
@_,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -320,6 +323,8 @@ sub load_cgi {
|
|||||||
# In either event, fall over if object creation failed
|
# In either event, fall over if object creation failed
|
||||||
die "Unable to load cgi" if(!$cgi);
|
die "Unable to load cgi" if(!$cgi);
|
||||||
|
|
||||||
|
# Set up post stuff
|
||||||
|
$CGI::POST_MAX = $self -> {"post_max"} * 1048576;
|
||||||
$cgi -> upload_hook($upload_hook) if($upload_hook);
|
$cgi -> upload_hook($upload_hook) if($upload_hook);
|
||||||
|
|
||||||
return $cgi;
|
return $cgi;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user