Skip to content

Instantly share code, notes, and snippets.

@Krayons
Krayons / cors_server.py
Last active August 29, 2015 14:05 — forked from enjalot/cors_server.py
python 3 for of enjalot/cors_server.py
import http.server
class CORSHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or