Skip to content

Commit 381f350

Browse files
committed
proxy: switching not available for ip resolver either
tests: update tests for auth and ip resolver to check that proxy magic is not set
1 parent e9b11fc commit 381f350

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pywb/framework/proxy_resolvers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __init__(self, routes, config):
123123

124124
@property
125125
def supports_switching(self):
126-
return True
126+
return False
127127

128128
def _get_ip(self, env):
129129
ip = env['REMOTE_ADDR']

tests/test_proxy_http_auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ def _assert_basic_text(self, resp):
2222
assert resp.content_type == 'text/plain'
2323
assert resp.content_length > 0
2424

25+
assert 'proxy_magic = ""' in resp.body
26+
assert 'wb.js' in resp.body
27+
2528
# 'Simulating' proxy by settings REQUEST_URI explicitly to http:// url and no SCRIPT_NAME
2629
# would be nice to be able to test proxy more
2730
def test_proxy_replay(self):
2831
resp = self.testapp.get('/x-ignore-this-x', extra_environ = dict(REQUEST_URI = 'http://www.iana.org/domains/idn-tables', SCRIPT_NAME = ''))
2932
self._assert_basic_html(resp)
3033

3134
assert '"20140126201127"' in resp.body
32-
assert 'wb.js' in resp.body
3335

3436
def test_proxy_replay_auth_filtered(self):
3537
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('pywb-filt-2:'))]
@@ -39,7 +41,6 @@ def test_proxy_replay_auth_filtered(self):
3941
self._assert_basic_html(resp)
4042

4143
assert '"20140126200624"' in resp.body
42-
assert 'wb.js' in resp.body
4344

4445
def test_proxy_replay_auth(self):
4546
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('pywb'))]
@@ -49,7 +50,6 @@ def test_proxy_replay_auth(self):
4950
self._assert_basic_html(resp)
5051

5152
assert '"20140127171238"' in resp.body
52-
assert 'wb.js' in resp.body
5353

5454
def test_proxy_replay_auth_no_coll(self):
5555
headers = [('Proxy-Authorization', 'Basic ' + base64.b64encode('no-such-coll'))]

tests/test_proxy_http_ip.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def _assert_basic_html(self, resp):
1818
assert resp.status_int == 200
1919
assert resp.content_type == 'text/html'
2020
assert resp.content_length > 0
21+
assert 'proxy_magic = ""' in resp.body
2122

2223
def _assert_basic_text(self, resp):
2324
assert resp.status_int == 200

0 commit comments

Comments
 (0)