if (HttpRuleParser.GetTokenLength(value, 0) != value.Length)
{
- throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, value));
+ throw new FormatException(SR.Format(CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, value));
}
}
if ((HttpRuleParser.GetCommentLength(value, 0, out length) != HttpParseResult.Parsed) ||
(length != value.Length)) // no trailing spaces allowed
{
- throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, value));
+ throw new FormatException(SR.Format(CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, value));
}
}
if ((HttpRuleParser.GetQuotedStringLength(value, 0, out length) != HttpParseResult.Parsed) ||
(length != value.Length)) // no trailing spaces allowed
{
- throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, value));
+ throw new FormatException(SR.Format(CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, value));
}
}
}
internal static bool TryParseInt32(string value, out int result) =>
- int.TryParse(value, NumberStyles.None, provider: null, out result);
+ int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out result);
internal static bool TryParseInt32(string value, int offset, int length, out int result)
{
return false;
}
- return int.TryParse(value.AsSpan(offset, length), NumberStyles.None, provider: null, out result);
+ return int.TryParse(value.AsSpan(offset, length), NumberStyles.None, CultureInfo.InvariantCulture, out result);
}
internal static bool TryParseInt64(string value, int offset, int length, out long result)
return false;
}
- return long.TryParse(value.AsSpan(offset, length), NumberStyles.None, provider: null, out result);
+ return long.TryParse(value.AsSpan(offset, length), NumberStyles.None, CultureInfo.InvariantCulture, out result);
}
internal static void DumpHeaders(StringBuilder sb, params HttpHeaders?[] headers)
// http.sys only supports %uXXXX (4 hex-digits), even though unicode code points could have up to
// 6 hex digits. Therefore we parse always 4 characters after %u and convert them to an int.
int codePointValue;
- if (!int.TryParse(codePoint, NumberStyles.HexNumber, null, out codePointValue))
+ if (!int.TryParse(codePoint, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out codePointValue))
{
if (NetEventSource.Log.IsEnabled())
NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_percent_value, codePoint));
private bool AddPercentEncodedOctetToRawOctetsList(Encoding encoding, string escapedCharacter)
{
byte encodedValue;
- if (!byte.TryParse(escapedCharacter, NumberStyles.HexNumber, null, out encodedValue))
+ if (!byte.TryParse(escapedCharacter, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out encodedValue))
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, SR.Format(SR.net_log_listener_cant_convert_percent_value, escapedCharacter));
return false;