Proyecto

General

Perfil

32 manumora
from BaseHTTPServer import BaseHTTPRequestHandler
import os
34 manumora
import shutil
35 manumora
import MyUtils
32 manumora
class MyHandler(BaseHTTPRequestHandler):

35 manumora
def do_GET(self):
try:
if self.path.endswith(".iso") or self.path.endswith(".md5"):
39 manumora
file = "/var/lib/autocloneserver/www/" + self.path
32 manumora
f = open(file)
s = os.path.getsize(file)

self.send_response(200)
35 manumora
self.send_header('Content-type', MyUtils.getMimeType(self.path))
32 manumora
self.send_header('Content-Length', s)
self.end_headers()

34 manumora
shutil.copyfileobj(f, self.wfile)
32 manumora
f.close()
return

35 manumora
except IOError:
pass