Skip to content

Commit 03a2242

Browse files
committedJan 1, 2012
Add native size limiting to WebGUI via plack. This is no longer a WRE specific feature.
1 parent 55a05e9 commit 03a2242

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
 

‎lib/WebGUI.pm

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ sub call {
6666
my $self = shift;
6767
my $env = shift;
6868

69+
##Enable size limiting
70+
$env->{'psgix.harakiri'} = 1;
71+
6972
my $session = $env->{'webgui.session'}
7073
or die 'Missing WebGUI Session - check WebGUI::Middleware::Session';
7174

‎sbin/testEnvironment.pl

+1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ BEGIN
184184
checkModule('common::sense', '3.2' );
185185
checkModule('Geo::Coder::Googlev3', '0.07' );
186186
checkModule('IO::File::WithPath', );
187+
checkModule('Plack::Middleware::SizeLimit', );
187188

188189
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
189190

‎share/site.psgi

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ builder {
88
my $config = $wg->config;
99
my $streaming_uploads = $config->get('enableStreamingUploads'); # have to restart for changes to this to take effect
1010

11+
if (! $^O eq 'darwin') {
12+
enable 'Plack::Middleware::SizeLimit' => (
13+
max_unshared_size => 200_000,
14+
max_process_size => 500_000,
15+
check_every_n_requests => 3,
16+
);
17+
}
1118
enable 'Log4perl', category => $config->getFilename, conf => WebGUI::Paths->logConfig;
1219
enable 'SimpleContentFilter', filter => sub {
1320
if ( utf8::is_utf8($_) ) {

0 commit comments

Comments
 (0)
Please sign in to comment.