From 7ab398eba588794a290e1923c42b69081a243872 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 19 Aug 2014 03:15:42 -0400 Subject: [PATCH] proxy tests: test download page --- pywb/framework/proxy.py | 5 +++-- tests/test_proxy_https.py | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/pywb/framework/proxy.py b/pywb/framework/proxy.py index 7af7e599..43c3c6c1 100644 --- a/pywb/framework/proxy.py +++ b/pywb/framework/proxy.py @@ -226,7 +226,7 @@ class ProxyRouter(object): sock = socket.socket(_sock=conn) except Exception: pass - elif env.get('gunicorn.socket'): + elif env.get('gunicorn.socket'): # pragma: no cover sock = env['gunicorn.socket'] if not sock: @@ -260,7 +260,8 @@ class ProxyRouter(object): certfile=certfile, ciphers="ALL", suppress_ragged_eofs=False, - ssl_version=ssl.PROTOCOL_SSLv23) + #ssl_version=ssl.PROTOCOL_SSLv23 + ) env['pywb.proxy_ssl_sock'] = ssl_sock buffreader = BufferedReader(ssl_sock, block_size=self.BLOCK_SIZE) diff --git a/tests/test_proxy_https.py b/tests/test_proxy_https.py index 811da411..1306fb0d 100644 --- a/tests/test_proxy_https.py +++ b/tests/test_proxy_https.py @@ -71,4 +71,27 @@ def test_replay_static(): assert resp.status_code == 200 found = u'function init_banner' in resp.text assert found, resp.text - resp.close() + +def test_replay_dl_page(): + resp = requests.get('https://pywb.proxy/', + proxies=server.proxy_dict, + verify=TEST_CA_ROOT) + assert resp.status_code == 200 + assert 'text/html' in resp.headers['content-type'] + found = u'Download' in resp.text + assert found, resp.text + +def test_dl_pem(): + resp = requests.get('https://pywb.proxy/pywb-ca.pem', + proxies=server.proxy_dict, + verify=TEST_CA_ROOT) + + assert resp.headers['content-type'] == 'application/x-x509-ca-cert' + +def test_dl_p12(): + resp = requests.get('https://pywb.proxy/pywb-ca.p12', + proxies=server.proxy_dict, + verify=TEST_CA_ROOT) + + assert resp.headers['content-type'] == 'application/x-pkcs12' +