Skip to content

Commit e5e97d2

Browse files
authored
Add brotli support to emrun.py (#19011)
* Add brotli support to emrun.py * Remove lookup to Accept-Encoding for gzip
1 parent 0f494e6 commit e5e97d2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

emrun.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,12 +637,18 @@ def send_head(self):
637637
# gzipped file, instead of having the browser decompress it immediately,
638638
# then it can't use the suffix .gz when using emrun.
639639
# To work around, one can use the suffix .gzip instead.
640-
if 'Accept-Encoding' in self.headers and 'gzip' in self.headers['Accept-Encoding'] and path.lower().endswith('gz'):
640+
if path.lower().endswith('gz'):
641641
self.send_header('Content-Encoding', 'gzip')
642642
logv('Serving ' + path + ' as gzip-compressed.')
643643
guess_file_type = guess_file_type[:-2]
644644
if guess_file_type.endswith('.'):
645645
guess_file_type = guess_file_type[:-1]
646+
elif path.lower().endswith('br'):
647+
self.send_header('Content-Encoding', 'br')
648+
logv('Serving ' + path + ' as brotli-compressed.')
649+
guess_file_type = guess_file_type[:-2]
650+
if guess_file_type.endswith('.'):
651+
guess_file_type = guess_file_type[:-1]
646652

647653
ctype = self.guess_type(guess_file_type)
648654
if guess_file_type.lower().endswith('.wasm'):

0 commit comments

Comments
 (0)