(self)
| 140 | |
| 141 | class InvalidGzipHandler(RequestHandler): |
| 142 | def get(self) -> None: |
| 143 | # set Content-Encoding manually to avoid automatic gzip encoding |
| 144 | self.set_header("Content-Type", "text/plain") |
| 145 | self.set_header("Content-Encoding", "gzip") |
| 146 | # Triggering the potential bug seems to depend on input length. |
| 147 | # This length is taken from the bad-response example reported in |
| 148 | # https://github.com/tornadoweb/tornado/pull/2875 (uncompressed). |
| 149 | text = "".join("Hello World {}\n".format(i) for i in range(9000))[:149051] |
| 150 | body = gzip.compress(text.encode(), compresslevel=6) + b"\00" |
| 151 | self.write(body) |
| 152 | |
| 153 | |
| 154 | class HeaderEncodingHandler(RequestHandler): |
nothing calls this directly
no test coverage detected