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.
####
METHOD: {
.
.
# avoid unreasonably large postings
if (($POST_MAX > 0) && ($content_length > $POST_MAX)) {
$self->cgi_error("413 Request entity too large");
last METHOD;
}
.
.
}
####
#!/usr/bin/perl -Tw
use strict;
BEGIN {
my $POST_MAX = 1048576;
my $content_length = defined $ENV{'CONTENT_LENGTH'} ? $ENV{'CONTENT_LENGTH'} : 0;
if ( ($POST_MAX > 0) && ($content_length > $POST_MAX) ) {
# 413 request entity too large error handling
}
}
use CGI;