Skip to content

Elm reactor doesn't serve large files correctly #1972

Open
@mgree

Description

@mgree

Quick Summary: elm reactor doesn't properly serve a wasm file (magic numbers corrupted; downloaded binary files differ in size).

Seems to be the same as elm-lang/elm-reactor#214.

SSCCE

Put z3w.wasm from https://github.com/cpitclaudel/z3.wasm/releases/tag/v0.1 in a directory and serve it from elm reactor. Download z3w.wasm---the file sizes differ. Doing the same procedure with python -m http.server yields a file of correct size.

$ ls -al | grep z3w.wasm
-rw-r--r--@  1 mgree  staff  18267869 Aug 20 14:59 elm.z3w.wasm
-rw-r--r--@  1 mgree  staff  18267216 Aug 20 14:42 py.z3w.wasm
-rw-r--r--@  1 mgree  staff  18267216 Aug 20 14:42 z3w.wasm
  • Elm: 0.19.0
  • Browser: Firefox 68.0.1 and Chrome 76.0.3809.100
  • Operating System: OS X 10.13.6

Probable fix

The reactor seems to be sending the wasm file as text/html rather than application/octet-stream:

$ wget -O elm.z3w.wasm http://localhost:8000/app/z3w.wasm
--2019-08-20 14:59:51--  http://localhost:8000/app/z3w.wasm
Resolving localhost (localhost)... 127.0.0.1, ::1, fe80::1
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘elm.z3w.wasm’

I suspect that text munging (e.g., null bytes, newlines, carriage returns, etc.) is the source of the problem. Doing better Content-Type inference would help (see also elm-lang/elm-reactor#217).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions