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

bpo-35292: Avoid call mimetypes.init when http.server is imported #17822

Open
wants to merge 1 commit into
base: master
from

Conversation

@aisk
Copy link
Contributor

aisk commented Jan 4, 2020

Proxy the http.server.SimpleHTTPRequestHandler.guess_type to mimetypes.guess_type so the mimetypes.init is called lazily to avoid unnecessary costs when the file is imported.

The default extensions_map is checked before call mimetypes.guess_type, with default value in mimetypes.encodings_map, for don't let mimetypes.guess_type returns the mine type besides the encoding type.

This method is implemented as https://bugs.python.org/issue35292#msg331739 said @zooba

https://bugs.python.org/issue35292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.