You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often it's convenient to send an HTTP response from an inline-constructed H:R object:
$req->respond( HTTP::Response->new( 200, "OK", [ "Content-Type" => "text/plain" ],
"Hello, world",
) );
Problem is if I do this, the response object has no Content-Length, no Connection=close and no chunked transfer encoding. The HTTP server/client now have no way to communicate the end of the response and the client will never see the end.
It's not always convenient to store the content in a variable first,
my $content = ...
$req->respond( HTTP::Response->new( 200, "OK", [ "Content-Type" => "text/plain", "Content-Length" => length $content ], $content ) );
It might be nice to have a constructor to do this
sub new_with_content_length
{
my $self = shift->new( @_ );
$self->content_length( length $self->content ) if defined $self->content;
$self;
}
--
Paul Evans
The text was updated successfully, but these errors were encountered:
Migrated from rt.cpan.org#106990 (status was 'new')
Requestors:
From [email protected] on 2015-09-09 15:33:38:
The text was updated successfully, but these errors were encountered: