aboutsummaryrefslogtreecommitdiff
path: root/scripts/irdb.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2007-10-30 02:45:51 +0000
committerRob Austein <sra@hactrn.net>2007-10-30 02:45:51 +0000
commita26a26995c11d13dd836c086f04d7485e158bd26 (patch)
tree9aadd973bc476e8d49a96ac5fa04b5daca7cd8d6 /scripts/irdb.py
parent1ebf3e0f12ee9be1f237532399d11e25da95177c (diff)
Parse listener URL
svn path=/scripts/irdb.py; revision=1200
Diffstat (limited to 'scripts/irdb.py')
-rwxr-xr-xscripts/irdb.py17
1 files changed, 13 insertions, 4 deletions
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 })