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

Multipart boundary validation #16

Merged
merged 7 commits into from
Sep 27, 2024
Merged

Multipart boundary validation #16

merged 7 commits into from
Sep 27, 2024

Conversation

zefir-git
Copy link
Owner

@zefir-git zefir-git commented Sep 26, 2024

This PR adds validation for the Multipart boundary input. As per RFC 2046, Section 5.1.1.:

The only mandatory global parameter for the "multipart" media type is
the boundary parameter, which consists of 1 to 70 characters from a
set of characters known to be very robust through mail gateways, and
NOT ending with white space. (If a boundary delimiter line appears to
end with white space, the white space must be presumed to have been
added by a gateway, and must be deleted.) It is formally specified
by the following BNF:

boundary := 0*69<bchars> bcharsnospace

bchars := bcharsnospace / " "

bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
                 "+" / "_" / "," / "-" / "." /
                 "/" / ":" / "=" / "?"

A warning will be shown when parsing multipart with an invalid boundary. An error will be thrown when building a multipart bode bytes.

@zefir-git zefir-git self-assigned this Sep 26, 2024
only throw error when building multipart body bytes
show warning when parsing
@zefir-git zefir-git added the enhancement Improvement of existing feature label Sep 26, 2024
@zefir-git zefir-git marked this pull request as ready for review September 26, 2024 18:13
@zefir-git zefir-git merged commit 210d457 into main Sep 27, 2024
3 checks passed
@zefir-git zefir-git deleted the boundary-validation branch September 27, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant