miyagawa/Plack — Issue #258: SSL mode: Content-Length of first request is reused
Author: heraldb
Created: 2011-12-05 16:54:10+00:00
State: open

Hi,

I am using perl-Plack-0.9985-1.fc16.noarch and while the content-length in the http header is correct in http mode, the content-length of the first request is reused for the second request (and following requests) when running in https mode (I used plackup --server HTTP::Server::PSGI --enable-ssl etc).

When debugging I found a work around by changing Plack/Middleware/ContentLength.pm:

return $self->response_cb($res, sub {
my $res = shift;
my $h = Plack::Util::headers($res->[1]);
if (!Plack::Util::status_with_no_entity_body($res->[0]) &&
---> #!$h->exists('Content-Length') &&
!$h->exists('Transfer-Encoding') &&
defined(my $content_length = Plack::Util::content_length($res->[2]))) {
$h->push('Content-Length' => $content_length);
}
});

So commenting out the check if the Content-Length existed. I suppose it is somewhere copied while it should not....

Thanks,
Herald