Skip to content

Commit 586fa48

Browse files
authored
Fix issue #947 (#948)
* Always remove zstd from the Accept-Encoding HTTP header.
1 parent ee13248 commit 586fa48

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pywb/rewrite/rewriteinputreq.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ def get_req_headers(self):
9393
if self.splits:
9494
value = self.splits.scheme
9595

96-
elif not has_brotli and name == 'HTTP_ACCEPT_ENCODING' and 'br' in value:
96+
elif name == 'HTTP_ACCEPT_ENCODING':
9797
# if brotli not available, remove 'br' from accept-encoding to avoid
9898
# capture brotli encoded content
99+
# We have to remove zstd from the list of accepted encodings as warcio does not support it.
100+
disallowed_encodings = ('zstd',) if has_brotli else ('zstd', 'br')
99101
name = 'Accept-Encoding'
100-
value = ','.join([enc for enc in value.split(',') if enc.strip() != 'br'])
102+
value = ','.join([enc for enc in value.split(',') if enc.strip() not in disallowed_encodings])
101103

102104
elif name.startswith('HTTP_'):
103105
name = name[5:].title().replace('_', '-')

0 commit comments

Comments
 (0)