Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect content length due to eol appending #226

Open
bbkr opened this issue Jun 6, 2019 · 1 comment
Open

Incorrect content length due to eol appending #226

bbkr opened this issue Jun 6, 2019 · 1 comment

Comments

@bbkr
Copy link

bbkr commented Jun 6, 2019

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

$s ~= $.content ~ $eol if $.content and !$debug;

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?

@zjmarlow
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants