BaseHttpServer

Paul pauljefferson at gmail.com
Sun Feb 15 12:31:23 EST 2009


Hi,
I currently have a webserver using BaseHttpServe that serves images
like this:
if self.path.endswith(".jpg"):
                print(curdir + sep + self.path)
                f = open(curdir + sep + self.path,"b")
                self.send_response(200)
                self.send_header('Content-type',	'image/jpg')
                self.end_headers()
                self.wfile.write(f.read())
                f.close()
                return
Whilst it works, it does take quite a while to load (approx 10secs for
a 4mb file even though its over the local connection) - does anyone
have any hints/tips for speeding it up?
Thanks,
Paul



More information about the Python-list mailing list