Skip to content

Releases

Version 0.0.34

Choose a tag to compare

@Kludex Kludex released this 16 Nov 10:39
c511ff0

⚡ 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 MultipartParseError instead of being returned as part data. Padded opening boundaries remain unsupported.
  • Non-ASCII parameter bytes are preserved (#364). parse_options_header trims 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: base64 is recognized and decoded despite the trailing space. Low-level MultipartParser callbacks still receive the raw header value bytes.

🛡️ Isolated callbacks and clearer security scope

  • Callback registrations stay with their parser (#362). Parsers constructed without callbacks now get separate dictionaries, so calling set_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-Encoding decoding 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

Choose a tag to compare

@Kludex Kludex released this 31 Oct 14:22
9217f26

🛡️ 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_FIELDS and MAX_FIELD_SIZE options for FormParser raise FormParserError before 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 AttributeError when UPLOAD_KEEP_EXTENSIONS or UPLOAD_KEEP_FILENAME was set.
  • UPLOAD_DIR accepts str with UPLOAD_KEEP_FILENAME (#335). A str upload directory used to fail on the first write to disk.
  • Decoded data is complete before callbacks run (#336, #355). Content-Transfer-Encoding decoders are finalized at the end of each part, and quoted-printable escapes split across writes decode correctly.
  • parse_options_header lowercases content types with parameters (#287). Multipart/Form-Data; boundary=abc now returns multipart/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 repr is now multipart.END instead 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

Choose a tag to compare

@Kludex Kludex released this 04 Jun 15:53
238ead6

What's Changed

  • Replace per-byte partial-boundary scan with rfind lookbehind by @Kludex in #300

Full Changelog: 0.0.31...0.0.32

Version 0.0.31

Choose a tag to compare

@Kludex Kludex released this 04 Jun 08:24
4cffc68

What's Changed

  • Speed up multipart header parsing and callback dispatch by @Kludex in #295
  • Bound header field name size before validating by @Kludex in #296
  • Validate Content-Length is non-negative in parse_form by @Kludex in #297

Full Changelog: 0.0.30...0.0.31

Version 0.0.30

Choose a tag to compare

@Kludex Kludex released this 31 May 19:23
9d3ead5

What's Changed

  • Treat only & as the urlencoded field separator by @Kludex in #290
  • Ignore RFC 2231 extended parameters in parse_options_header by @Kludex in #291

Full Changelog: 0.0.29...0.0.30

Version 0.0.29

Choose a tag to compare

@Kludex Kludex released this 17 May 13:51
e3d6853

What's Changed

  • Handle malformed RFC 2231 continuations in parse_options_header by @manunio in #270

Full Changelog: 0.0.28...0.0.29

Version 0.0.28

Choose a tag to compare

@Kludex Kludex released this 10 May 11:04
7d8d28b

What's Changed

  • Speed up partial-boundary tail scan via bytes.find by @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

Choose a tag to compare

@Kludex Kludex released this 27 Apr 10:50
6d1d689

What's Changed

Full Changelog: 0.0.26...0.0.27

Version 0.0.26

Choose a tag to compare

@Kludex Kludex released this 10 Apr 14:08
28f4785

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

Choose a tag to compare

@Kludex Kludex released this 10 Apr 13:13
4addb60

What's Changed

  • Apply Apache-2.0 properly by @Kludex in #247
  • Handle multipart headers case-insensitively by @Kludex in #252
  • Emit field_end for trailing bare field names on finalize by @bysiber in #230
  • Add UPLOAD_DELETE_TMP to FormParser config 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