Title: support application/wasm in mimetypes and http.server
Type: enhancement Stage: resolved
Components: Versions: Python 3.8
Status: closed Resolution: out of date
Dependencies: Superseder: http.server module sets incorrect mimetype for WebAssembly files
View: 34758
Assigned To: Nosy List: martin.panter, pmpp, r.david.murray, steven.daprano
Priority: normal Keywords:

Created on 2018-12-04 08:14 by pmpp, last changed 2019-03-30 23:27 by martin.panter. This issue is now closed.

Messages (5)
msg331015 - (view) Author: pmp-p (pmpp) * Date: 2018-12-04 08:14
web browsers have recently gained ability to run webassembly code and for that a new content type has to be add to web servers for optimal use:

wasm => Content-Type header : application/wasm

spec says it :

"Firefox streaming compilation needs Content-Type header set"


google's filament documentation says:
"Python's simple server [...] does not serve WebAssembly files with the correct MIME type."

it would be logical since simple htt server is mostly used for testing software to offer support of that new techonology.
msg331016 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2018-12-04 08:24
Python 3.7 is in feature-freeze, so any new features like this will have to be 3.8 only.
msg331528 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2018-12-10 17:53
We don't generally add a mime type until it is a de-jure or de-facto standard.  If it is still in testing it is probably too soon to add it.  For testing, you can always add it yourself in your code via the api that mimetypes provides.
msg331644 - (view) Author: pmp-p (pmpp) * Date: 2018-12-11 18:46
Sure, but i was considering the cpython in the browser/webview/electron case where python modules are served as .wasm files, i'm about to do it for my port and pyodide already does. 
It would make sense to provide the *simplest* environnement for cpython to serve its own components.

scientific cpython stack in the browser:

python repl in the browser experiment:

Also i think cpython in the browser could be be already beyond testing and so far provides the best sandboxing configuration available around :
"run python in a sandbox, not the opposite" ( quoting Victor Stinner )
msg339230 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2019-03-30 23:25
According to Issue 34758, this was already added to 3.8’s “mimetypes”.
Date User Action Args
2019-03-30 23:27:42martin.pantersetsuperseder: http.server module sets incorrect mimetype for WebAssembly files
2019-03-30 23:25:39martin.pantersetstatus: open -> closed

nosy: + martin.panter
messages: + msg339230

resolution: out of date
stage: resolved
2018-12-11 18:46:05pmppsetmessages: + msg331644
2018-12-10 17:53:21r.david.murraysetmessages: + msg331528
2018-12-07 22:34:39terry.reedysetnosy: + r.david.murray
2018-12-04 08:24:53steven.dapranosetnosy: + steven.daprano

messages: + msg331016
versions: - Python 3.7
2018-12-04 08:14:04pmppcreate