fix webapp on Windows

- the p12 file needs a ".p12" extension. simply naming the file "p12"
  isn't sufficient
This commit is contained in:
Maximilian Hils 2015-03-19 16:17:44 +01:00
parent 5721e5bd27
commit a2cbfb117b

View File

@ -38,27 +38,31 @@ class Index(tornado.web.RequestHandler):
class PEM(tornado.web.RequestHandler): class PEM(tornado.web.RequestHandler):
@property
def filename(self):
return config.CONF_BASENAME + "-ca-cert.pem"
def get(self): def get(self):
p = os.path.join( p = os.path.join(self.request.master.server.config.cadir, self.filename)
self.request.master.server.config.cadir, self.set_header("Content-Type", "application/x-x509-ca-cert")
config.CONF_BASENAME + "-ca-cert.pem" self.set_header("Content-Disposition", "attachment; filename={}".format(self.filename))
)
self.set_header( with open(p, "rb") as f:
"Content-Type", "application/x-x509-ca-cert" self.write(f.read())
)
self.write(open(p, "rb").read())
class P12(tornado.web.RequestHandler): class P12(tornado.web.RequestHandler):
@property
def filename(self):
return config.CONF_BASENAME + "-ca-cert.p12"
def get(self): def get(self):
p = os.path.join( p = os.path.join(self.request.master.server.config.cadir, self.filename)
self.request.master.server.config.cadir, self.set_header("Content-Type", "application/x-pkcs12")
config.CONF_BASENAME + "-ca-cert.p12" self.set_header("Content-Disposition", "attachment; filename={}".format(self.filename))
)
self.set_header( with open(p, "rb") as f:
"Content-Type", "application/x-pkcs12" self.write(f.read())
)
self.write(open(p, "rb").read())
application = tornado.web.Application( application = tornado.web.Application(