Add native size limiting to WebGUI via plack. This is no longer a WRE specific feature.
This commit is contained in:
parent
55a05e99fa
commit
03a22421a7
3 changed files with 11 additions and 0 deletions
|
|
@ -66,6 +66,9 @@ sub call {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $env = shift;
|
my $env = shift;
|
||||||
|
|
||||||
|
##Enable size limiting
|
||||||
|
$env->{'psgix.harakiri'} = 1;
|
||||||
|
|
||||||
my $session = $env->{'webgui.session'}
|
my $session = $env->{'webgui.session'}
|
||||||
or die 'Missing WebGUI Session - check WebGUI::Middleware::Session';
|
or die 'Missing WebGUI Session - check WebGUI::Middleware::Session';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ checkModule('Data::ICal', '0.16' );
|
||||||
checkModule('common::sense', '3.2' );
|
checkModule('common::sense', '3.2' );
|
||||||
checkModule('Geo::Coder::Googlev3', '0.07' );
|
checkModule('Geo::Coder::Googlev3', '0.07' );
|
||||||
checkModule('IO::File::WithPath', );
|
checkModule('IO::File::WithPath', );
|
||||||
|
checkModule('Plack::Middleware::SizeLimit', );
|
||||||
|
|
||||||
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ builder {
|
||||||
my $config = $wg->config;
|
my $config = $wg->config;
|
||||||
my $streaming_uploads = $config->get('enableStreamingUploads'); # have to restart for changes to this to take effect
|
my $streaming_uploads = $config->get('enableStreamingUploads'); # have to restart for changes to this to take effect
|
||||||
|
|
||||||
|
if (! $^O eq 'darwin') {
|
||||||
|
enable 'Plack::Middleware::SizeLimit' => (
|
||||||
|
max_unshared_size => 200_000,
|
||||||
|
max_process_size => 500_000,
|
||||||
|
check_every_n_requests => 3,
|
||||||
|
);
|
||||||
|
}
|
||||||
enable 'Log4perl', category => $config->getFilename, conf => WebGUI::Paths->logConfig;
|
enable 'Log4perl', category => $config->getFilename, conf => WebGUI::Paths->logConfig;
|
||||||
enable 'SimpleContentFilter', filter => sub {
|
enable 'SimpleContentFilter', filter => sub {
|
||||||
if ( utf8::is_utf8($_) ) {
|
if ( utf8::is_utf8($_) ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue