servesHost method

bool servesHost(
  1. String? host
)

true when the folder serves host (the Host header). The domain may have a port (localhost:3000) or not, like a domain route.

Implementation

bool servesHost(String? host) {
  String? want = domain;
  if (want == null) return true;
  if (host == null) return false;
  host = host.toLowerCase();
  if (want == host) return true;
  int end = host.startsWith('[') ? host.indexOf(']') + 1 : 0;
  int colon = host.indexOf(':', end);
  return colon != -1 && want == host.substring(0, colon);
}