GeezerVison is showing github.com — gh-92626: Correct JavaScript MIME types + extensions per RFC 9239 by mathiasbynens · Pull Request #92627 · python/cpython
Conversation
This patch updates the MIME type configuration per RFC 9239.
https://www.rfc-editor.org/rfc/rfc9239
First, the recommended MIME type is now text/javascript:
The most widely supported media type in use is text/javascript; all
others are considered historical and obsolete aliases of text/javascript.
Second, the .mjs extension is now explicitly registered:
The .mjs file extension signals that the file represents a JavaScript
module. Execution environments that rely on file extensions to
determine how to process inputs parse .mjs files using the Module
grammar of [ECMA-262].
cpython already had an entry for .mjs (great!), but it was using the obsolete
MIME type.
IANA template: https://www.iana.org/assignments/media-types/text/javascript
Issue: #92626
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This patch updates the MIME type configuration per RFC 9239.
https://www.rfc-editor.org/rfc/rfc9239
First, the recommended MIME type is now `text/javascript`:
> The most widely supported media type in use is `text/javascript`; all
> others are considered historical and obsolete aliases of `text/javascript`.
Second, the `.mjs` extension is now explicitly registered:
> The `.mjs` file extension signals that the file represents a JavaScript
> module. Execution environments that rely on file extensions to
> determine how to process inputs parse `.mjs` files using the Module
> grammar of [ECMA-262].
IANA template: https://www.iana.org/assignments/media-types/text/javascript
ghost
commented
May 10, 2022
•
edited by ghost
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
All commit authors signed the Contributor License Agreement. 
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced May 10, 2022
RFC: 9239
Published: May 2022
6.1.Common JavaScript Media Types
6.1.1. text/javascript
🎉🎉🎉 Finally encoding-aware human-readable text is treated as such (text/*) instead of binary blobs (application/*).
text
Text-only data including any human-readable content, source code, or textual data such as comma-separated value (CSV) formatted data.
application
Any kind of binary data that doesn't fall explicitly into one of the other types; either data that will be executed or interpreted in some way or binary data that requires a specific application or category of application to use. Generic binary data (or binary data whose true type is unknown) is application/octet-stream. Other common examples include application/pdf, application/pkcs8, and application/zip.
-- https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
|
mathiasbynens reacted with hooray emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Lib/test/mime.types should maybe be updated, although it seems that file hasn't been substantively updated since 2011:
|
# text/javascript obsoleted by application/javascript |
Also:
|
AddType application/javascript js |
|
AddType application/wasm wasm |
|
|
|
<IfModule mod_deflate.c> |
|
AddOutputFilterByType DEFLATE text/html application/javascript application/wasm |
A
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@warsaw would we backport something like this? I'm unsure if it would count as a bugfix.
A
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It would be great to have this PR merged since it brings stuff to the latest RFC.
|
mathiasbynens and nhardy reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This was changed in #97934. Apologies for forgetting this PR.
|
mathiasbynens reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|