| 455 | return data |
| 456 | |
| 457 | def _decode_content(self, data): |
| 458 | encoding = self.headers[CONTENT_ENCODING].lower() |
| 459 | |
| 460 | if encoding == 'deflate': |
| 461 | return zlib.decompress(data, -zlib.MAX_WBITS) |
| 462 | elif encoding == 'gzip': |
| 463 | return zlib.decompress(data, 16 + zlib.MAX_WBITS) |
| 464 | elif encoding == 'identity': |
| 465 | return data |
| 466 | else: |
| 467 | raise RuntimeError('unknown content encoding: {}'.format(encoding)) |
| 468 | |
| 469 | def _decode_content_transfer(self, data): |
| 470 | encoding = self.headers[CONTENT_TRANSFER_ENCODING].lower() |