the following code yields wrong octet counts if $content contains wide characters, e.g. "\x{100}":
sub render_response {
[...]
$response->header( 'Content-Length' => length($content) )
if !defined $response->header('Content-Length');
... as length() per default operates on character sematics.
suggested fix:
{
use bytes;
$response->header( 'Content-Length' => length($content) )
if !defined $response->header('Content-Length');
}