mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
rewrite headers: undo not rewriting x- headers, needs more research and exclusions (eg. x-frame-options)
This commit is contained in:
parent
cf6cfc0c44
commit
658303caad
@ -166,9 +166,6 @@ class HeaderRewriter(object):
|
||||
else:
|
||||
add_prefixed_header(name, value)
|
||||
|
||||
elif lowername.startswith('x-'):
|
||||
add_header(name, value)
|
||||
|
||||
elif urlrewriter:
|
||||
add_prefixed_header(name, value)
|
||||
else:
|
||||
|
@ -39,7 +39,7 @@ HTTP Headers Rewriting
|
||||
('Set-Cookie', 'foo=bar; Path=/web/20131010/http://example.com/'),
|
||||
('Content-Encoding', 'gzip'),
|
||||
('X-Archive-Orig-Transfer-Encoding', 'chunked'),
|
||||
('X-Proxy', 'test')]),
|
||||
('X-Archive-Orig-X-Proxy', 'test')]),
|
||||
'text_type': None}
|
||||
|
||||
"""
|
||||
|
@ -116,7 +116,7 @@ class TestProxyLiveRewriter:
|
||||
|
||||
# equal to returned response (echo)
|
||||
assert self.requestlog[0] == resp.text
|
||||
assert resp.headers['x-proxy'] == 'test'
|
||||
assert resp.headers['x-archive-orig-x-proxy'] == 'test'
|
||||
|
||||
assert resp.text.startswith('GET http://example.com/ HTTP/1.1')
|
||||
assert 'referer: http://other.example.com' in resp.text.lower()
|
||||
@ -136,7 +136,7 @@ class TestProxyLiveRewriter:
|
||||
|
||||
# proxied, but without range
|
||||
assert self.requestlog[0] == resp.text
|
||||
assert resp.headers['x-proxy'] == 'test'
|
||||
assert resp.headers['x-archive-orig-x-proxy'] == 'test'
|
||||
|
||||
assert self.requestlog[0].startswith('GET http://example.com/ HTTP/1.1')
|
||||
assert 'range: ' not in self.requestlog[0]
|
||||
@ -182,7 +182,7 @@ class TestProxyLiveRewriter:
|
||||
assert resp.headers['Accept-Ranges'] == 'bytes'
|
||||
|
||||
# not from proxy
|
||||
assert 'x-proxy' not in resp.headers
|
||||
assert 'x-archive-orig-x-proxy' not in resp.headers
|
||||
|
||||
# already pinged proxy, no additional requests set to proxy
|
||||
assert len(self.requestlog) == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user