Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unsafe code and make scheme parsing faster in Uri #90087

Merged
merged 3 commits into from Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -75,11 +75,7 @@ internal static string ParseCanonicalName(string str, int start, int end, ref bo
if (index >= 0)
{
// We saw uppercase letters. Avoid allocating both the substring and the lower-cased variant.
return string.Create(end - start, (str, start), static (buffer, state) =>
{
int newLength = state.str.AsSpan(state.start, buffer.Length).ToLowerInvariant(buffer);
Debug.Assert(newLength == buffer.Length);
});
return UriHelper.SpanToLowerInvariantString(str.AsSpan(start, end - start));
}

if (str.AsSpan(start, end - start) is Localhost or Loopback)
Expand Down