Skip to content

UTF-8 body corruption #118

Closed
Closed
@jamiehodge

Description

@jamiehodge

Expected Behaviour
One expects the default/fallback behaviour to correctly assemble UTF-8 multibyte characters in the request body.

Actual Behaviour
The default/fallback behaviour incorrectly assembles requests that exceed the input stream chunk size. Multibyte characters that straddle chunks are incorrectly parsed, resulting in replacement characters or arbitrary single byte characters.

Example: https://github.com/graphql/graphql-http/blob/main/src/use/http.ts#L144-L146

Debug Information
Send an HTTP request with a variable assigned to a large number of fx "å" that exceeds the request body stream high-water mark. The value passed to the schema will be intermittently corrupted.

Further Information
It appears as though simply calling req.setEncoding("utf8"); is enough to address the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleasedHas been released and published

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions