diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2020-01-14 15:01:00 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2020-01-14 17:07:06 +0100 |
commit | 1798496ea77aedbed4193c9ed516f8437cd05c0f (patch) | |
tree | 390900e0b722076c347a0f5d0b81fa62fe8b337e /platform/javascript/export | |
parent | dc0f43a1c2218990d36add82be1feb2dacaa5796 (diff) |
Add mime type to responses from debug HTTP server.
Get rid of warnings in firefox mentioning performance loss when no mime
type is given for wasm files.
Diffstat (limited to 'platform/javascript/export')
-rw-r--r-- | platform/javascript/export/export.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 93c83f4ff4..53983f7556 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -87,16 +87,22 @@ public: String filepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export"); String basereq = "/tmp_js_export"; + String ctype = ""; if (req[1] == basereq + ".html") { filepath += ".html"; + ctype = "text/html"; } else if (req[1] == basereq + ".js") { filepath += ".js"; + ctype = "application/javascript"; } else if (req[1] == basereq + ".pck") { filepath += ".pck"; + ctype = "application/octet-stream"; } else if (req[1] == basereq + ".png") { filepath += ".png"; + ctype = "image/png"; } else if (req[1] == basereq + ".wasm") { filepath += ".wasm"; + ctype = "application/wasm"; } else { String s = "HTTP/1.1 404 Not Found\r\n"; s += "Connection: Close\r\n"; @@ -109,6 +115,7 @@ public: ERR_FAIL_COND(!f); String s = "HTTP/1.1 200 OK\r\n"; s += "Connection: Close\r\n"; + s += "Content-Type: " + ctype + "\r\n"; s += "\r\n"; CharString cs = s.utf8(); Error err = connection->put_data((const uint8_t *)cs.get_data(), cs.size() - 1); |