Repository navigation
Releases
Version 0.0.34
⚡ Faster form parsing
This release reduces parser overhead for forms with many fields and corrects multipart boundary and header handling. Parsers created without callbacks also no longer share callback registrations.
pip install python-multipart==0.0.34- Faster query-string parsing (#372). The parser reuses separator positions and starts the next field directly when its data is already available.
- Less overhead for multipart forms (#370, #373). Complete CRLF sequences are consumed without stepping through each intermediate parser state, and mark-helper functions are no longer created on each write.
🧩 More predictable multipart handling
- Padded boundaries no longer merge adjacent parts (#363). Spaces and tabs after delimiters between parts are recognized as transport padding. Malformed padding now raises
MultipartParseErrorinstead of being returned as part data. Padded opening boundaries remain unsupported. - Non-ASCII parameter bytes are preserved (#364).
parse_options_headertrims only spaces and tabs, rather than all Unicode whitespace. This avoids changing parameter values such as names ending in the UTF-8 bytes forà. - Whitespace around part header values is ignored by
FormParser(#366). For example,Content-Transfer-Encoding: base64is recognized and decoded despite the trailing space. Low-levelMultipartParsercallbacks still receive the raw header value bytes.
🛡️ Isolated callbacks and clearer security scope
- Callback registrations stay with their parser (#362). Parsers constructed without
callbacksnow get separate dictionaries, so callingset_callback()on one no longer changes another parser's handlers. - A documented threat model (#358, #359, #367). The threat model defines trust boundaries, application responsibilities, and vulnerability scope. Bugs in deprecated
Content-Transfer-Encodingdecoding are handled as public bug reports rather than security reports.
💜 Thank you
Thanks to @deadstrobe5 and @g4lb for the parser performance proposals that informed this release.
Full changelog: 0.0.33...0.0.34
Version 0.0.33
🛡️ Safer form parsing
This release lets you cap URL-encoded form fields as they stream in, and fixes several upload and decoding edge cases. It also drops Python 3.10 and adds Python 3.15.
pip install python-multipart==0.0.33- Limit URL-encoded fields while streaming (#333). The new opt-in
MAX_FIELDSandMAX_FIELD_SIZEoptions forFormParserraiseFormParserErrorbefore oversized data is buffered. Both default to no limit, and multipart forms are unaffected. - Nameless uploads no longer crash when spilled to disk (#343). Uploads without a filename used to raise
AttributeErrorwhenUPLOAD_KEEP_EXTENSIONSorUPLOAD_KEEP_FILENAMEwas set. UPLOAD_DIRacceptsstrwithUPLOAD_KEEP_FILENAME(#335). Astrupload directory used to fail on the first write to disk.- Decoded data is complete before callbacks run (#336, #355).
Content-Transfer-Encodingdecoders are finalized at the end of each part, and quoted-printable escapes split across writes decode correctly. parse_options_headerlowercases content types with parameters (#287).Multipart/Form-Data; boundary=abcnow returnsmultipart/form-data, the same as headers without parameters.
⚡ Faster parsing
- Faster opening boundary matching (#328). Complete boundaries are matched in one step.
- Faster parser state lookups (#330). Parser states are module-level enum members, so their
repris nowmultipart.ENDinstead of<MultipartState.END: 12>. - Faster querystring callback dispatch (#316).
🐍 Python support
- Python 3.10 is no longer supported (#329). Python 3.11 is now the minimum.
- Python 3.15 is supported (#350).
💜 Thank you
Thanks to @Edneam, @sungbin1015, @carlok, and @fjvbn2003 for contributing to this release.
Thanks to the individual sponsors who contributed $134.00 to support this work. If python-multipart is useful to you, consider sponsoring me on GitHub.
Full changelog: 0.0.32...0.0.33
Version 0.0.32
What's Changed
Full Changelog: 0.0.31...0.0.32
Version 0.0.31
Version 0.0.30
What's Changed
- Treat only
&as the urlencoded field separator by @Kludex in #290 - Ignore RFC 2231 extended parameters in
parse_options_headerby @Kludex in #291
Full Changelog: 0.0.29...0.0.30
Version 0.0.29
What's Changed
Full Changelog: 0.0.28...0.0.29
Version 0.0.28
What's Changed
- Speed up partial-boundary tail scan via
bytes.findby @Kludex in #281 - Cap multipart boundary length at 256 bytes by @Kludex in #282
Full Changelog: 0.0.27...0.0.28
Version 0.0.27
What's Changed
- Pass parse offsets via constructors by @Kludex in #268
- Add multipart header limits by @Kludex in #267
Full Changelog: 0.0.26...0.0.27
Version 0.0.26
What's Changed
- Skip preamble before first multipart boundary by @Kludex in #262
- Silently discard epilogue data after the closing boundary by @Kludex in #259
Full Changelog: 0.0.25...0.0.26
Version 0.0.25
What's Changed
- Apply Apache-2.0 properly by @Kludex in #247
- Handle multipart headers case-insensitively by @Kludex in #252
- Emit
field_endfor trailing bare field names on finalize by @bysiber in #230 - Add
UPLOAD_DELETE_TMPtoFormParserconfig by @Kludex in #254 - Remove custom FormParser classes by @Kludex in #257
- Handle CTE values case-insensitively by @Kludex in #258
- Add MIME content type info to File by @jhnstrk in #143
Full Changelog: 0.0.24...0.0.25