Created
December 14, 2017 11:05
-
-
Save akarelas-pt/892ba328a43ab0b14128ca82459279b5 to your computer and use it in GitHub Desktop.
Shows error on browser when uploading file of size 100MB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
app->max_request_size(10 * 1024); | |
get '/' => sub { | |
my $c = shift; | |
$c->render(template => 'index'); | |
}; | |
post '/submit' => sub { | |
my $c = shift; | |
my $exceeded = $c->req->is_limit_exceeded; | |
$c->render(json => { | |
title => 'hi there', | |
exceeded => $exceeded, | |
}); | |
}; | |
app->start; | |
__DATA__ | |
@@ index.html.ep | |
% layout 'default'; | |
% title 'Welcome'; | |
<h1>Welcome to the Mojolicious real-time web framework!</h1> | |
To learn more, you can browse through the documentation | |
<%= link_to 'here' => '/perldoc' %>. | |
@@ layouts/default.html.ep | |
<!DOCTYPE html> | |
<html> | |
<head><title><%= title %></title></head> | |
<body> | |
<form method="post" action="/submit" enctype="multipart/form-data"> | |
<input type="file" name="a_file" /> | |
<input type="submit" /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running it with
morbo myapp.pl
on my local desktop machine, and accessing the site it produces with http://localhost:3000, so there's no proxy or real network between me and the mojolicious site.The problem:
When I upload a 100kB file, it works fine (produces a JSON with exceeded: 1), but when I upload a 100MB file, I get an error screen on the browser. Both on the newest Firefox and on the newest Chromium browsers.
My system is a 1 y.o. Fedora Linux.