diff options
author | Rob Austein <sra@hactrn.net> | 2007-08-08 15:01:51 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-08-08 15:01:51 +0000 |
commit | 9be98cafee7a8995e05af666c13ae97e33154d58 (patch) | |
tree | 0ef9cc9a96a2ec450fa99353f564ff8fdc87cd1e /scripts/rpki/https.py | |
parent | 7ee387948c67d2e1a7a73444ec10ad2f35f11d3c (diff) |
Cleanup
svn path=/scripts/rpki/https.py; revision=842
Diffstat (limited to 'scripts/rpki/https.py')
-rw-r--r-- | scripts/rpki/https.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/rpki/https.py b/scripts/rpki/https.py index dfcb3e7a..f63b12ba 100644 --- a/scripts/rpki/https.py +++ b/scripts/rpki/https.py @@ -10,6 +10,8 @@ subversion repository; generalizing it would not be hard, but the more general version should use SQL anyway. """ +rpki_content_type = "application/x-rpki" + class CertInfo(object): self.cert-dir = "biz-certs/" @@ -46,7 +48,7 @@ class CertInfo(object): def client(msg, certInfo, host="localhost", port=4433, url="/"): httpc = tlslite.api.HTTPTLSConnection(host, port, privateKey=certInfo.privatekey, certChain=certInfo.certChain, x509TrustList=certInfo.x509TrustList) httpc.connect() - httpc.request("POST", url, msg, {"Content-Type":"application/x-rpki"}) + httpc.request("POST", url, msg, {"Content-Type" : rpki_content_type}) response = httpc.getresponse() assert response.status == httplib.OK return response.read() @@ -56,11 +58,11 @@ class requestHandler(BaseHTTPServer.BaseHTTPRequestHandler): rpki_handler = None # Subclass must bind def do_POST(self): - assert self.headers["Content-Type"] == "application/x-rpki" + assert self.headers["Content-Type"] == rpki_content_type self.query_string = self.rfile.read(int(self.headers["Content-Length"])) rcode, rtext = self.rpki_handler(self.query_string) self.send_response(rcode) - self.send_header("Content-Type", "application/x-rpki") + self.send_header("Content-Type", rpki_content_type) self.end_headers() self.wfile.write(rtext) |