Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/Http/Http.Extensions/src/UriHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ namespace Microsoft.AspNetCore.Http.Extensions
/// </summary>
public static class UriHelper
{
private const string ForwardSlash = "/";
private const string Pound = "#";
private const string QuestionMark = "?";
private const char ForwardSlash = '/';
private const char Hash = '#';
private const char QuestionMark = '?';
private const string SchemeDelimiter = "://";

/// <summary>
Expand Down Expand Up @@ -103,7 +103,7 @@ public static void FromAbsolute(
path = new PathString();
query = new QueryString();
fragment = new FragmentString();
var startIndex = uri.IndexOf(SchemeDelimiter);
var startIndex = uri.IndexOf(SchemeDelimiter, StringComparison.Ordinal);

if (startIndex < 0)
{
Expand All @@ -115,10 +115,9 @@ public static void FromAbsolute(
// PERF: Calculate the end of the scheme for next IndexOf
startIndex += SchemeDelimiter.Length;

var searchIndex = -1;
int searchIndex;
var limit = uri.Length;

if ((searchIndex = uri.IndexOf(Pound, startIndex)) >= 0 && searchIndex < limit)
if ((searchIndex = uri.IndexOf(Hash, startIndex)) >= 0 && searchIndex < limit)
{
fragment = FragmentString.FromUriComponent(uri.Substring(searchIndex));
limit = searchIndex;
Expand Down