private static void CheckAgent(string agent)
{
if (string.IsNullOrEmpty(agent))
{
throw new ArgumentException(SR.net_http_argument_empty_string, nameof(agent));
}
// 'receivedBy' can either be a host or a token. Since a token is a valid host, we only verify if the value
// is a valid host.
string host = null;
if (HttpRuleParser.GetHostLength(agent, 0, true, out host) != agent.Length)
{
throw new FormatException(string.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, agent));
}
}
}