29104528cc
These scripts are useful when testing WebAssembly locally because the mimetype impacts how the binaries are loaded. The porting was achieved by doing the following: python -m lib2to3 -w -n serve.py Change-Id: I09673fa881339a9b157c5fc993e190766efcd85e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443884 Reviewed-by: Erik Rose <erikrose@google.com>
22 lines
522 B
Python
22 lines
522 B
Python
#!/usr/bin/env python3
|
|
# Copyright 2018 Google LLC
|
|
#
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import http.server
|
|
import socketserver
|
|
|
|
PORT = 8000
|
|
|
|
class Handler(http.server.SimpleHTTPRequestHandler):
|
|
pass
|
|
|
|
Handler.extensions_map['.js'] = 'application/javascript'
|
|
# Without the correct MIME type, async compilation doesn't work
|
|
Handler.extensions_map['.wasm'] = 'application/wasm'
|
|
|
|
httpd = socketserver.TCPServer(("", PORT), Handler)
|
|
|
|
httpd.serve_forever()
|