Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pywb/rewrite/rewriteinputreq.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ def get_req_headers(self):
if self.splits:
value = self.splits.scheme

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

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