static private GetValueLength ( string input, int startIndex ) : int | ||
input | string | |
startIndex | int | |
Результат | int |
internal static int GetValueLength(string input, int startIndex)
{
Debug.Assert(input != null);
if (startIndex >= input.Length)
{
return 0;
}
int valueLength = HttpRuleParser.GetTokenLength(input, startIndex);
if (valueLength == 0)
{
// A value can either be a token or a quoted string. Check if it is a quoted string.
if (HttpRuleParser.GetQuotedStringLength(input, startIndex, out valueLength) != HttpParseResult.Parsed)
{
// We have an invalid value. Reset the name and return.
return 0;
}
}
return valueLength;
}
private static void CheckValueFormat(string value) { if (!string.IsNullOrEmpty(value) && NameValueHeaderValue.GetValueLength(value, 0) != value.Length) { throw new FormatException(SR.Format((IFormatProvider)CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, (object)value)); } }