Heuristic: is this URL likely a large file download?
(self, url: str, headers: dict)
| 1296 | return await self.fronter.relay(method, url, headers, body) |
| 1297 | |
| 1298 | def _is_likely_download(self, url: str, headers: dict) -> bool: |
| 1299 | """Heuristic: is this URL likely a large file download?""" |
| 1300 | path = url.split("?")[0].lower() |
| 1301 | if self._download_any_extension: |
| 1302 | return True |
| 1303 | for ext in self._download_extensions: |
| 1304 | if path.endswith(ext): |
| 1305 | return True |
| 1306 | accept = header_value(headers, "accept").lower() |
| 1307 | if any(marker in accept for marker in self._DOWNLOAD_ACCEPT_MARKERS): |
| 1308 | return True |
| 1309 | return False |
| 1310 | |
| 1311 | async def _maybe_stream_download(self, method: str, url: str, |
| 1312 | headers: dict | None, body: bytes, |
no test coverage detected