Skip to content
Browse files

Fixed an invalid chunked response when Content-Length is 0. Fixes gh-8

  • Loading branch information...
1 parent 790f14e commit 9454ac72d6e54e6ff7e63c8ae465daa3881115a1 @miyagawa committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Starman/Server.pm
View
4 lib/Starman/Server.pm
@@ -408,7 +408,7 @@ sub _finalize_response {
}
if ( $protocol eq 'HTTP/1.1' ) {
- if ( !$headers{'content-length'} ) {
+ if ( !exists $headers{'content-length'} ) {
if ( $status !~ /^1\d\d|[23]04$/ ) {
DEBUG && warn "[$$] Using chunked transfer-encoding to send unknown length body\n";
push @headers, 'Transfer-Encoding: chunked';
@@ -422,7 +422,7 @@ sub _finalize_response {
}
}
} else {
- if ( !$headers{'content-length'} ) {
+ if ( !exists $headers{'content-length'} ) {
DEBUG && warn "[$$] Disabling keep-alive after sending unknown length body on $protocol\n";
$self->{client}->{keepalive} = 0;
}

0 comments on commit 9454ac7

Please sign in to comment.
Something went wrong with that request. Please try again.