mirror of
https://github.com/django/django.git
synced 2025-11-18 11:00:24 +00:00
Fixed #36656 -- Avoided truncating async streaming responses in GZipMiddleware.
This commit is contained in:
parent
9bb83925d6
commit
a0323a0c44
3 changed files with 24 additions and 15 deletions
|
|
@ -2,6 +2,7 @@ import gzip
|
|||
import random
|
||||
import re
|
||||
import struct
|
||||
import zlib
|
||||
from io import BytesIO
|
||||
from unittest import mock
|
||||
from urllib.parse import quote
|
||||
|
|
@ -880,8 +881,8 @@ class GZipMiddlewareTest(SimpleTestCase):
|
|||
|
||||
@staticmethod
|
||||
def decompress(gzipped_string):
|
||||
with gzip.GzipFile(mode="rb", fileobj=BytesIO(gzipped_string)) as f:
|
||||
return f.read()
|
||||
# Use zlib to ensure gzipped_string contains exactly one gzip stream.
|
||||
return zlib.decompress(gzipped_string, zlib.MAX_WBITS | 16)
|
||||
|
||||
@staticmethod
|
||||
def get_mtime(gzipped_string):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue