untrusted

fun untrusted(userAgent: String, policy: OutboundUrlPolicy.Untrusted = OutboundUrlPolicy.untrusted(), resolve: (host: String) -> List<InetAddress> = { InetAddress.getAllByName(it).toList() }, configure: UrlFetcherConfig.() -> Unit = {}): UrlFetcher(source)

A fetcher under an Untrusted policy with every rule live except the loopback ones (the host localhost, 127.0.0.0/8, ::1 and the port rule for exactly those hosts).

Return

the fetcher; the caller closes it.

Parameters

userAgent

the User-Agent sent on every request, under the rule of the public UrlFetcher(userAgent) factory: non-blank, visible ASCII, no leading or trailing space.

policy

the policy; the defaults when omitted.

resolve

answers a host name with addresses; the system resolver by default. Called on the transport's own threads, never the caller's, and possibly from several at once, so it must be thread-safe; it may block. Its exceptions reach the transport unchanged.

configure

sets the budget (caller-owned, never closed by the fetcher), reader, clocks and defaultMaxWait; empty by default.

Throws

for a userAgent the public factory refuses, a policy.settings.maxResponseBytes above Int.MAX_VALUE - 8 or a negative defaultMaxWait; nothing stays open, and the message is constant and never echoes a value.