Permalink
Browse files

Additional HTTP POST/PUT method robustness fix.

  • Loading branch information...
1 parent b4db4f3 commit cacce525e5ed77612a2a9cd0cf455cd96eee8fa8 Brane F. Gračnar committed Mar 27, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/P9/AA/Protocol/HTTP.pm
@@ -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);
@@ -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);

0 comments on commit cacce52

Please sign in to comment.