http-useragent icon indicating copy to clipboard operation
http-useragent copied to clipboard

Incorrect content length due to eol appending

Open bbkr opened this issue 6 years ago • 4 comments

HTTP::Message in Str method is silently appending EOL:

https://github.com/sergot/http-useragent/blob/cfdfc48c55d312049f90f1db61042718c1de9908/lib/HTTP/Message.pm6#L231

This causes Content-Length calculated by user to be incorrect:

$response = HTTP::Response.new;
$response.set-code( 200 );

my $content = 'foo';   # 3 bytes
$response.add-content( $content );
$response.field( Content-Length => $content.encode.bytes );

$socket.print( $response.Str ); # will send 2 bytes more than declared

Why is this EOL appended? User content should not be tampered with. Is this behavior described somewhere in RFC?

bbkr avatar Jun 06 '19 10:06 bbkr

Can this please be fixed? Firefox Web Driver isn't handling the extra EOL.

zjmarlow avatar Jan 30 '23 17:01 zjmarlow