Skip to content

Commit

Permalink
Additional HTTP POST/PUT method robustness fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brane F. Gračnar committed Mar 27, 2012
1 parent b4db4f3 commit cacce52
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/P9/AA/Protocol/HTTP.pm
Expand Up @@ -237,7 +237,15 @@ sub parse {
$req = undef;
goto outta_parse;
}


# try to convert it into int
{ no warnings; $cl += 0 }
# too big request body?
if ($cl > 1024 * 1024) {
$self->error("Request entity too big (413).");
return undef;
}

# has client sent Expect request header?
if (defined(my $e = $req->header('Expect'))) {
$e = lc($e);
Expand All @@ -246,16 +254,8 @@ sub parse {
}
}

# try to convert it into int
{ no warnings; $cl += 0 }

# read content body
if ($do_read && $cl > 0) {
# too big request body?
if ($cl > 1024 * 1024) {
$self->error("Request entity too big (413).");
return undef;
}

my $buf = '';
my $r = read($fd, $buf, $cl);
Expand Down

0 comments on commit cacce52

Please sign in to comment.