Permalink
Browse files

small optimization

  • Loading branch information...
1 parent 262c2cd commit 418faa65957f432631b95168f4233ceecd5003e5 @kraih committed Mar 8, 2014
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/Mojo/Message.pm
View
@@ -98,15 +98,14 @@ sub finish {
sub fix_headers {
my $self = shift;
+ return $self if $self->{fix}++;
# Content-Length or Connection (unless chunked transfer encoding is used)
my $content = $self->content;
- return $self if $self->{fix}++ || $content->is_chunked;
- my $headers = $self->headers;
- $content->is_dynamic
- ? $headers->connection('close')
- : $headers->content_length($self->body_size)
- unless $headers->content_length;
+ my $headers = $content->headers;
+ return $self if $content->is_chunked || $headers->content_length;
+ if ($content->is_dynamic) { $headers->connection('close') }
+ else { $headers->content_length($self->body_size) }
return $self;
}

0 comments on commit 418faa6

Please sign in to comment.