20 lines
473 B
Python
20 lines
473 B
Python
# Bryan Schumaker (5 / 15 / 2011)
|
|
|
|
from BaseHTTPServer import BaseHTTPRequestHandler
|
|
import files
|
|
|
|
class Handler(BaseHTTPRequestHandler):
|
|
def do_GET(self):
|
|
path = files.format_path(self.path)
|
|
if not files.find_file(path):
|
|
self.send_error(404, "File Not Found: %s" % path)
|
|
return
|
|
|
|
type = files.get_type(path)
|
|
self.send_response(200)
|
|
self.send_header('Content-type', type)
|
|
self.end_headers()
|
|
|
|
files.send_file(self.wfile.write, path)
|
|
self.wfile.close()
|