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

feat(parse_header): provide our own implementation of parse_header() #2217

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

vytas7
Copy link
Member

@vytas7 vytas7 commented Mar 21, 2024

I have another branch which also introduces Cython's "pure Python mode" in order to speed up parse_header(), but we can circle back on that optimization in Falcon 4.1.

I'm also planning to reimplement the parts of mimeparse that we actually use, and unvendor it completely.

Fixes #2066

@vytas7 vytas7 requested review from nZac, kgriffs and CaselIT March 21, 2024 20:59
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a78cfb3) to head (e209b20).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2217   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           62        63    +1     
  Lines         6888      6930   +42     
  Branches      1099      1109   +10     
=========================================
+ Hits          6888      6930   +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

CaselIT
CaselIT previously approved these changes Mar 21, 2024
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have just glanced at the mediatypes module since it's copied from the stdlib.

Did you make changes to it?

falcon/util/mediatypes.py Outdated Show resolved Hide resolved
+ address 1 review comment
@vytas7
Copy link
Member Author

vytas7 commented Mar 22, 2024

have just glanced at the mediatypes module since it's copied from the stdlib.

Did you make changes to it?

@CaselIT yes, I wrote a much simpler implementation for the common case, and fall back to the old stdlib impl for more complex cases.

@CaselIT
Copy link
Member

CaselIT commented Mar 22, 2024

Ok, I'll take a better look later

CaselIT
CaselIT previously approved these changes Apr 3, 2024
Copy link
Member

@CaselIT CaselIT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok but could maybe use one more test

tests/test_mediatypes.py Show resolved Hide resolved
@vytas7 vytas7 merged commit 7ec1d31 into falconry:master Apr 3, 2024
36 of 37 checks passed
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.

Replace usage of cgi.parse_header() (slated for removal in 3.13)
2 participants