Proyecto

General

Perfil

from BaseHTTPServer import BaseHTTPRequestHandler
import os
import shutil
import MyUtils

class MyHandler(BaseHTTPRequestHandler):

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

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

shutil.copyfileobj(f, self.wfile)
f.close()
return
except IOError:
pass
(2-2/4)