… | |
… | |
784 | } |
784 | } |
785 | }; |
785 | }; |
786 | |
786 | |
787 | $ae_error = 597; # body phase |
787 | $ae_error = 597; # body phase |
788 | |
788 | |
|
|
789 | my $chunked = $hdr{"transfer-encoding"} =~ /\bchunked\b/i; # not quite correct... |
|
|
790 | |
789 | my $len = $hdr{"content-length"}; |
791 | my $len = $chunked ? undef : $hdr{"content-length"}; |
790 | |
792 | |
791 | # body handling, many different code paths |
793 | # body handling, many different code paths |
792 | # - no body expected |
794 | # - no body expected |
793 | # - want_body_handle |
795 | # - want_body_handle |
794 | # - te chunked |
796 | # - te chunked |
… | |
… | |
809 | $_[0]->on_error (undef); |
811 | $_[0]->on_error (undef); |
810 | $_[0]->on_read (undef); |
812 | $_[0]->on_read (undef); |
811 | |
813 | |
812 | $finish->(delete $state{handle}); |
814 | $finish->(delete $state{handle}); |
813 | |
815 | |
814 | } elsif ($hdr{"transfer-encoding"} =~ /\bchunked\b/i) { |
816 | } elsif ($chunked) { |
815 | my $cl = 0; |
817 | my $cl = 0; |
816 | my $body = undef; |
818 | my $body = undef; |
817 | my $on_body = $arg{on_body} || sub { $body .= shift; 1 }; |
819 | my $on_body = $arg{on_body} || sub { $body .= shift; 1 }; |
818 | |
820 | |
819 | $state{read_chunk} = sub { |
821 | $state{read_chunk} = sub { |