diff --git a/pywb/framework/certa.py b/pywb/framework/certa.py index 844ad497..d957dbad 100644 --- a/pywb/framework/certa.py +++ b/pywb/framework/certa.py @@ -7,7 +7,10 @@ import random class CertificateAuthority(object): logger = logging.getLogger('pywb.CertificateAuthority') - def __init__(self, ca_file='pywb-ca.pem', certs_dir='./pywb-ca'): + def __init__(self, ca_file='pywb-ca.pem', + certs_dir='./pywb-ca', + certname='pywb CA'): + self.ca_file = ca_file self.certs_dir = certs_dir @@ -31,7 +34,7 @@ class CertificateAuthority(object): self.cert.set_version(3) # avoid sec_error_reused_issuer_and_serial self.cert.set_serial_number(random.randint(0,2**64-1)) - self.cert.get_subject().CN = 'pywb CA on {}'.format('') + self.cert.get_subject().CN = certname self.cert.gmtime_adj_notBefore(0) # now self.cert.gmtime_adj_notAfter(100*365*24*60*60) # 100 yrs in future self.cert.set_issuer(self.cert.get_subject()) diff --git a/pywb/framework/wbrequestresponse.py b/pywb/framework/wbrequestresponse.py index 0f1a9f32..f2c63f9c 100644 --- a/pywb/framework/wbrequestresponse.py +++ b/pywb/framework/wbrequestresponse.py @@ -161,7 +161,8 @@ class WbResponse(object): @staticmethod def text_response(text, status='200 OK', content_type='text/plain'): status_headers = StatusAndHeaders(status, - [('Content-Type', content_type)]) + [('Content-Type', content_type), + ('Content-Length', str(len(text)))]) return WbResponse(status_headers, value=[text])