Skip to content

Don't warn when CRLF is found after last boundary#193

Merged
Kludex merged 3 commits intomasterfrom
not-warn-when-end-is-crlf
Dec 1, 2024
Merged

Don't warn when CRLF is found after last boundary#193
Kludex merged 3 commits intomasterfrom
not-warn-when-end-is-crlf

Conversation

@Kludex
Copy link
Copy Markdown
Owner

@Kludex Kludex commented Nov 30, 2024

@Kludex Kludex changed the title Not warn if ends with CRLF Don't warn when CRLF is found after last boundary Nov 30, 2024
@Kludex
Copy link
Copy Markdown
Owner Author

Kludex commented Nov 30, 2024

cc @defnull

@Kludex Kludex merged commit c4fe4d3 into master Dec 1, 2024
@Kludex Kludex deleted the not-warn-when-end-is-crlf branch December 1, 2024 06:59
Kludex added a commit that referenced this pull request Apr 10, 2026
Django's MultiPartParser and Werkzeug's sansio multipart parser both
silently accept (and ignore) the optional CRLF + epilogue that RFC 2046
section 5.1.1 allows after the closing boundary. python-multipart was
logging "Skipping data after last boundary" instead, and the single-
chunk guard added in #193 also missed the case where the trailing CRLF
was split across two writes - a trailing `\r` at the end of one chunk
would fall through to the warning branch because `i + 1 < length` was
false, even though the `\n` arrived in the next chunk.

Drop the warning and the split-chunk guard entirely. The epilogue is
short-circuited the same way as before (no O(N) scan), just without
the spurious log line.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrectly warns Skipping data after the last boundary

1 participant