Skip to content

The values of the MIME type parameters aren't parsed as ASCII strings #141

@andreubotella

Description

@andreubotella

If the "parse a MIME type" algorithm is called on a string like "multipart/form-data; boundary=áèîøü", the parsing succeeds, and the resulting MIME type record has a "boundary" parameter of "áèîøü", even though the MIME type definition specifies that parameter values are ASCII strings.

This is because in the parsing algorithm, the essence and parameter names must only contain HTTP token code points, which are a subset of ASCII; but parameter values must only contain HTTP quoted-string token code points, which aren't.

I found this as part of working on a multipart/form-data parser in https://github.com/andreubotella/multipart-form-data, since I noticed that some browsers accept a boundary string with code points between U+0080 and U+00FF while others don't, and after going down the rabbit hole of fetch algorithms, this seems to be the cause of that incompatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions