Skip to content
New issue

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

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

Already on GitHub? # to your account

Incorrect content-length in callback.js when body contains non-ascii characters #52

Open
NickMitin opened this issue Feb 4, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@NickMitin
Copy link

Incorrect content-length in callback.js when body contains non-ascii characters

callback.js, line 46 is:

     'Content-Length': data.length

callback.js, line 46 should be:

    'Content-Length': Buffer.byteLength(data)
@NickMitin NickMitin added the bug Something isn't working label Feb 4, 2021
@dmonad
Copy link
Member

dmonad commented Feb 4, 2021

You are right, the data object should be converted to a buffer first to determine the length of the content.

The RFC specifies that the content-length is specified as the number of octets (number of bytes) and not as the length of the string.

Would you be willing to provide a PR for this? I currently don't have a lot of time to spare..

@NickMitin
Copy link
Author

Sure, will do it in few days!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants