MCPcopy Index your code
hub / github.com/masterking32/MasterHttpRelayVPN / _is_likely_download

Method _is_likely_download

src/proxy/proxy_server.py:1298–1309  ·  view source on GitHub ↗

Heuristic: is this URL likely a large file download?

(self, url: str, headers: dict)

Source from the content-addressed store, hash-verified

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,

Callers 2

_relay_smartMethod · 0.95

Calls 1

header_valueFunction · 0.85

Tested by

no test coverage detected