Skip to content

Response ContentLength is invalid with 2-byte UTF-8 symbols in template #1

Description

@fedorovmv

For example - Cyrillic word "Привет".

Bug in DustCompilingFilter class in line

response.setContentLength(template.length());

You have to use

response.setContentLength(template.getBytes().length());

You use ByteOutputStream in response writer and when you write 2-bytes symbols to out (like "Привет") - length will be greater then template.length() (6) and will be equals to template.getBytes().length().

And when browser read the response stream, some last bytes will be lost and you get a error.

Please fix it

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions