TransportSettings

The caps, timeouts and concurrency limits of a transport, one set per OutboundUrlPolicy: they belong to the policy because Untrusted's caps and timeouts are part of what makes it untrusted.

Stable Core. Two default sets are supplied, TrustedDefaults and UntrustedDefaults; derive a modified copy with the factory TransportSettings(from) { ... }. Every default number is a judgement, documented here, and changing one is a behaviour change for every consumer that did not set it:

SettingTrustedDefaultsUntrustedDefaults
callTimeout (all hops together)30 s15 s
connectTimeout, readTimeout, writeTimeout10 s each5 s each
maxResponseBytes (decoded bytes)5 MiB (5,242,880)2 MiB (2,097,152)
maxRedirects53
allowHttpsToHttpfalsefalse
maxConcurrentRequests, maxConcurrentRequestsPerHost16, 58, 2
idleConnectionTtl4 s4 s

callTimeout spans every hop of a redirected fetch, not each hop. allowHttpsToHttp is read by the URL policy when it judges a redirect. Equality is on every setting; toString() prints every setting (numbers only).

Types

Link copied to clipboard

Collects the settings of a TransportSettings: one var per setting, seeded from the value the factory was given. Not thread-safe; use it only inside the factory's lambda. A lambda that reads a property before it assigns sees the seed (maxConcurrentRequests = maxOf(maxConcurrentRequests, 32)).

Link copied to clipboard
object Companion

The two supplied default sets.

Properties

Link copied to clipboard

Whether a redirect from https to http is followed; read by the URL policy.

Link copied to clipboard

The whole fetch, redirects included: at least 1 millisecond and at most Int.MAX_VALUE milliseconds.

Link copied to clipboard

The TCP connect timeout of one attempt; the same bounds as callTimeout.

Link copied to clipboard

How long an idle pooled connection is kept; the same bounds as callTimeout.

Link copied to clipboard

The most requests in flight; at least 1.

Link copied to clipboard

The most requests in flight to one host; at least 1 and at most maxConcurrentRequests.

Link copied to clipboard

The most redirects followed; 0 follows none (a followable redirect beyond the cap is TooManyRedirects).

Link copied to clipboard

The most decoded body bytes a transport reads; at least 1.

Link copied to clipboard

The socket read timeout; the same bounds as callTimeout.

Link copied to clipboard

The socket write timeout; the same bounds as callTimeout.

Functions

Link copied to clipboard
Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code consistent with equals: it is computed from the same properties.

Link copied to clipboard
open override fun toString(): String

A diagnostic string for logs: every setting. Its format is not part of the API and may change.