from http.server import BaseHTTPRequestHandler,HTTPServer
class Handler(BaseHTTPRequestHandler):
 def do_GET(self):
  if self.path == '/empty.png': body=b''; mime='image/png'
  elif self.path == '/one.png': body=b'x'; mime='image/png'
  elif self.path == '/large.png': body=b'x'*(11*1024*1024); mime='image/png'
  else: body=b'<h1>Shared image reproduction</h1><p><a href="/empty.png" download>Download empty.png</a></p><p><a href="/one.png" download>Download one.png</a></p><p><a href="/large.png" download>Download large.png</a></p>'; mime='text/html'
  self.send_response(200); self.send_header('Content-Type',mime); self.send_header('Content-Length',str(len(body)))
  if mime=='image/png': self.send_header('Content-Disposition','attachment; filename="'+self.path[1:]+'"')
  self.end_headers(); self.wfile.write(body)
HTTPServer(('0.0.0.0',8099),Handler).serve_forever()
