Skip to content

Commit

Permalink
fixed memory leak in Mojo::Message::Request
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 20, 2012
1 parent 208dd89 commit 6c84566
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

3.59 2012-11-20
- Improved tests.
- Fixed memory leak in Mojo::Message::Request.
- Fixed keep alive bug in Mojo::Server::Daemon.

3.58 2012-11-19
Expand Down
4 changes: 1 addition & 3 deletions lib/Mojo/Message.pm
Expand Up @@ -229,9 +229,7 @@ sub parse {
if $self->content->is_limit_exceeded;

# Progress
$self->emit('progress');

return $self->content->is_finished ? $self->finish : $self;
return $self->emit('progress')->content->is_finished ? $self->finish : $self;
}

sub start_line_size { length shift->build_start_line }
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojo/Message/Request.pm
Expand Up @@ -159,11 +159,11 @@ sub parse {

# CGI like environment
$self->env($env)->_parse_env($env) if $env;
$self->content($self->content->parse_body(@args))
if ($self->{state} // '') eq 'cgi';
my $cgi = ($self->{state} // '') eq 'cgi';
$self->content($self->content->parse_body(@args)) if $cgi;

# Pass through
$self->SUPER::parse(@args);
# Pass through for normal requests
$self->SUPER::parse($cgi ? undef : @args);

# Check if we can fix things that require all headers
return $self unless $self->is_finished;
Expand Down

0 comments on commit 6c84566

Please sign in to comment.