From a26a26995c11d13dd836c086f04d7485e158bd26 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 30 Oct 2007 02:45:51 +0000 Subject: Parse listener URL svn path=/scripts/irdb.py; revision=1200 --- scripts/irdb.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scripts/irdb.py') diff --git a/scripts/irdb.py b/scripts/irdb.py index eb17381b..40adfd9e 100755 --- a/scripts/irdb.py +++ b/scripts/irdb.py @@ -1,6 +1,6 @@ # $Id$ -import tlslite.api, MySQLdb +import tlslite.api, MySQLdb, urlparse import rpki.https, rpki.config, rpki.resource_set, rpki.cms def handler(query, path): @@ -62,8 +62,17 @@ cms_ta = rpki.x509.X509(Auto_file = cfg.get(cfg_section, "cms-ta")) cms_key = rpki.x509.RSA(Auto_file = cfg.get(cfg_section, "cms-key")) cms_certs = rpki.x509.X509_chain(Auto_files = cfg.multiget(cfg_section, "cms-cert")) +u = urlparse.urlparse(cfg.get(cfg_section, "https-url")) + +assert u.scheme in ("", "https") and \ + u.username is None and \ + u.password is None and \ + u.params == "" and \ + u.query == "" and \ + u.fragment == "" + rpki.https.server(privateKey = rpki.x509.RSA(Auto_file = cfg.get(cfg_section, "https-key")), certChain = rpki.x509.X509_chain(Auto_files = cfg.multiget(cfg_section, "https-cert")), - host = cfg.get(cfg_section, "https-host"), - port = int(cfg.get(cfg_section, "https-port")), - handlers = { cfg.get(cfg_section, "https-url") : handler }) + host = u.hostname or "localhost", + port = u.port or 443, + handlers = { u.path : handler }) -- cgit v1.2.3