trusted

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

A fetcher under a Trusted policy with cleartext forced on (loopback servers speak http) in both the transport and the pre-check; no relaxation (Trusted has no loopback rule).

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. Every property but allowCleartext is kept.

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.