Skip to content

Conversation

@defnull
Copy link
Owner

@defnull defnull commented Feb 19, 2025

Allow use of the core parsing functionality for other use cases (e.g. multipart/byterange as described in #73) by allowing users to subclass MultipartSegment.

This is a WIP. First step was to clean up the API between PushMultipartParser and MultipartSegment to make it easier to hook into those APIs. The new MultipartSegment._on_* methods are still private APIs and may change between releases, so be careful. But it looks nice now, so future changes should be less likely.

One idea was to split the segment class into MultipartSegmentBase implementing universal parsing logic only, and MultipartSegment implementing the additional checks and logic for form-data segments. I tried that, but it reduced throughput by up to 5% in some tests and made documentation more complicated. I'm not sure if I really want that, but it's not from the table just yet.

This patch includes refactoring and changes of internal APIs to allow stabilizing those APIs in the future.
@defnull defnull closed this Jul 7, 2025
@defnull
Copy link
Owner Author

defnull commented Jul 7, 2025

See #77 for a new approach

@defnull defnull deleted the feature-segment-subclass branch July 27, 2025 00:27
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.

2 participants