Expand description
Network utilities — SSRF protection, HTTP client helpers.
Functions§
- build_
http_ client - Build an HTTP client with the given timeout.
- build_
http_ client_ with_ options - Like
build_http_client, optionally without redirect-following. Blossom PUT usesfalse: a 3xx mid-upload would re-issue as GET and drop the body, so we surface the 3xx as the real failure status. - get_
remote_ file_ size - Get the size of a remote file via HEAD request or Range fallback. Returns None if the URL is private, unreachable, or size can’t be determined.
- rebuild_
shared_ http_ client - Rebuild the shared client. Call this when Tor state flips so the next request goes through the freshly-configured proxy. In-flight requests on the old client continue to completion on the previous Arc.
- shared_
http_ client - Get a shared HTTP client. Cheap clone (Arc), proxy-aware, picks up Tor
toggles on the next call after
rebuild_shared_http_client()runs. - validate_
url_ not_ private - Reject URLs that resolve to private/loopback/link-local addresses (SSRF protection).