GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-92626: Correct JavaScript MIME types + extensions per RFC 9239 by mathiasbynens · Pull Request #92627 · python/cpython

Conversation

@mathiasbynens

@mathiasbynens mathiasbynens commented May 10, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.

All reactions
@mathiasbynens
Correct JavaScript MIME types + extensions per RFC 9239
f504def
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
@mathiasbynens
mathiasbynens requested a review from a team as a code owner May 10, 2022 14:50
@ghost

ghost commented May 10, 2022 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented May 10, 2022

Copy link
Copy Markdown

Every change to Python requires a NEWS entry.

Please, add it using the blurb_it Web app or the blurb command-line tool.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added the awaiting review label May 10, 2022
@blurb-it
📜🤖 Added by blurb_it.
e574bf9
This was referenced May 10, 2022
Correct JavaScript MIME types + extensions per RFC 9239 jshttp/mime-db#262
Merged
Correct JavaScript MIME types + extensions per RFC 9239 apache/httpd#318
Closed
Correct JavaScript MIME types + extensions per RFC 9239 nginx/nginx#77
Closed
@arhadthedev

arhadthedev commented May 10, 2022

Copy link
Copy Markdown
Member

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
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mathiasbynens mathiasbynens mentioned this pull request May 10, 2022
Change .js mime to "text/javascript" #79056
Closed
@mathiasbynens
Merge branch 'main' into rfc-9239
5c788e5
@AA-Turner AA-Turner added stdlib Standard Library Python modules in the Lib/ directory topic-email labels May 27, 2022
@AA-Turner

AA-Turner commented May 27, 2022

Copy link
Copy Markdown
Member

Lib/test/mime.types should maybe be updated, although it seems that file hasn't been substantively updated since 2011:

cpython/Lib/test/mime.types

Line 1217 in cb04a09

# text/javascript obsoleted by application/javascript

Also:

cpython/Tools/wasm/README.md

Lines 213 to 217 in 1f134e9

AddType application/javascript js
AddType application/wasm wasm
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html application/javascript application/wasm

A

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented May 27, 2022

Copy link
Copy Markdown
Member

@warsaw would we backport something like this? I'm unsure if it would count as a bugfix.

A

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev

arhadthedev commented Oct 25, 2022

Copy link
Copy Markdown
Member

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
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou

encukou commented Mar 26, 2024

Copy link
Copy Markdown
Member

This was changed in #97934. Apologies for forgetting this PR.

mathiasbynens reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou closed this Mar 26, 2024
@mathiasbynens
mathiasbynens deleted the rfc-9239 branch March 26, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review stdlib Standard Library Python modules in the Lib/ directory topic-email

Projects

None yet

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.

5 participants

@mathiasbynens @bedevere-bot @arhadthedev @AA-Turner @encukou
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.