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:
| Setting | TrustedDefaults | UntrustedDefaults |
|---|---|---|
| callTimeout (all hops together) | 30 s | 15 s |
| connectTimeout, readTimeout, writeTimeout | 10 s each | 5 s each |
| maxResponseBytes (decoded bytes) | 5 MiB (5,242,880) | 2 MiB (2,097,152) |
| maxRedirects | 5 | 3 |
| allowHttpsToHttp | false | false |
| maxConcurrentRequests, maxConcurrentRequestsPerHost | 16, 5 | 8, 2 |
| idleConnectionTtl | 4 s | 4 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
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)).
Properties
Whether a redirect from https to http is followed; read by the URL policy.
The whole fetch, redirects included: at least 1 millisecond and at most Int.MAX_VALUE milliseconds.
The TCP connect timeout of one attempt; the same bounds as callTimeout.
How long an idle pooled connection is kept; the same bounds as callTimeout.
The most requests in flight; at least 1.
The most requests in flight to one host; at least 1 and at most maxConcurrentRequests.
The most redirects followed; 0 follows none (a followable redirect beyond the cap is TooManyRedirects).
The most decoded body bytes a transport reads; at least 1.
The socket read timeout; the same bounds as callTimeout.
The socket write timeout; the same bounds as callTimeout.
Functions
Two TransportSettings are equal when all ten of their settings are equal: callTimeout, connectTimeout, readTimeout, writeTimeout, maxResponseBytes, maxRedirects, allowHttpsToHttp, maxConcurrentRequests, maxConcurrentRequestsPerHost and idleConnectionTtl.