Skip to content

Commit

Permalink
Add native size limiting to WebGUI via plack. This is no longer a WRE…
Browse files Browse the repository at this point in the history
… specific feature.
  • Loading branch information
perlDreamer committed Jan 1, 2012
1 parent 55a05e9 commit 03a2242
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/WebGUI.pm
Expand Up @@ -66,6 +66,9 @@ sub call {
my $self = shift;
my $env = shift;

##Enable size limiting
$env->{'psgix.harakiri'} = 1;

my $session = $env->{'webgui.session'}
or die 'Missing WebGUI Session - check WebGUI::Middleware::Session';

Expand Down
1 change: 1 addition & 0 deletions sbin/testEnvironment.pl
Expand Up @@ -184,6 +184,7 @@ BEGIN
checkModule('common::sense', '3.2' );
checkModule('Geo::Coder::Googlev3', '0.07' );
checkModule('IO::File::WithPath', );
checkModule('Plack::Middleware::SizeLimit', );

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

Expand Down
7 changes: 7 additions & 0 deletions share/site.psgi
Expand Up @@ -8,6 +8,13 @@ builder {
my $config = $wg->config;
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 'SimpleContentFilter', filter => sub {
if ( utf8::is_utf8($_) ) {
Expand Down

0 comments on commit 03a2242

Please sign in to comment.