readClient static method

({String? ip, String scheme}) readClient(
  1. HttpRequest req,
  2. List<String> trusted
)

The client ip and scheme of req. trusted is the trustedProxies setting. It is parsed once per isolate. The answer is kept for req, so a second call is cheap.

Implementation

static ({String? ip, String scheme}) readClient(
  HttpRequest req,
  List<String> trusted,
) {
  if (!identical(trusted, _cachedList)) {
    _cached = TrustedProxy(trusted);
    _cachedList = trusted;
    _perRequest[req] = null;
  }
  return _perRequest[req] ??= _read(req);
}