--- AnyEvent-HTTP/HTTP.pm 2011/01/03 00:41:25 1.90 +++ AnyEvent-HTTP/HTTP.pm 2011/01/03 01:03:29 1.91 @@ -786,7 +786,9 @@ $ae_error = 597; # body phase - my $len = $hdr{"content-length"}; + my $chunked = $hdr{"transfer-encoding"} =~ /\bchunked\b/i; # not quite correct... + + my $len = $chunked ? undef : $hdr{"content-length"}; # body handling, many different code paths # - no body expected @@ -811,7 +813,7 @@ $finish->(delete $state{handle}); - } elsif ($hdr{"transfer-encoding"} =~ /\bchunked\b/i) { + } elsif ($chunked) { my $cl = 0; my $body = undef; my $on_body = $arg{on_body} || sub { $body .= shift; 1 };