Skip to content

Commit

Permalink
Fix all CA1307 warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeago committed Feb 21, 2020
1 parent 0a6dc79 commit 55c5929
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/packages/EmbedIO/Net/Internal/EndPointListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private static void ProcessAccept(SocketAsyncEventArgs args)

foreach (var p in list)
{
if (p.Path.Length < bestLength || !path.StartsWith(p.Path))
if (p.Path.Length < bestLength || !path.StartsWith(p.Path, StringComparison.Ordinal))
continue;

bestLength = p.Path.Length;
Expand Down Expand Up @@ -337,7 +337,7 @@ private static bool RemoveSpecial(IList<ListenerPrefix> coll, ListenerPrefix pre
if (p.Host != host || p.Port != port)
continue;

if (!path.StartsWith(p.Path) && !pathSlash.StartsWith(p.Path))
if (!path.StartsWith(p.Path, StringComparison.Ordinal) && !pathSlash.StartsWith(p.Path, StringComparison.Ordinal))
continue;

bestLength = p.Path.Length;
Expand Down
14 changes: 7 additions & 7 deletions src/packages/EmbedIO/Net/Internal/HttpListenerRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public bool KeepAlive
public bool IsWebSocketRequest
=> HttpVerb == HttpVerb.Get
&& ProtocolVersion >= HttpVersion.Version11
&& Headers.Contains(HttpHeaderNames.Upgrade, "websocket")
&& Headers.Contains(HttpHeaderNames.Connection, "Upgrade");
&& Headers.Contains(HttpHeaderNames.Upgrade, "websocket", StringComparison.OrdinalIgnoreCase)
&& Headers.Contains(HttpHeaderNames.Connection, "Upgrade", StringComparison.OrdinalIgnoreCase);

/// <summary>
/// Begins to the get client certificate asynchronously.
Expand Down Expand Up @@ -238,7 +238,7 @@ internal void SetRequestLine(string req)
}

RawUrl = parts[1];
if (parts[2].Length != 8 || !parts[2].StartsWith("HTTP/"))
if (parts[2].Length != 8 || !parts[2].StartsWith("HTTP/", StringComparison.Ordinal))
{
_context.ErrorMessage = "Invalid request line (version).";
return;
Expand Down Expand Up @@ -402,19 +402,19 @@ private void ParseCookies(string val)

foreach (var str in cookieStrings)
{
if (str.StartsWith("$Version"))
if (str.StartsWith("$Version", StringComparison.Ordinal))
{
version = int.Parse(str.Substring(str.IndexOf('=') + 1).Unquote(), CultureInfo.InvariantCulture);
}
else if (str.StartsWith("$Path") && current != null)
else if (str.StartsWith("$Path", StringComparison.Ordinal) && current != null)
{
current.Path = str.Substring(str.IndexOf('=') + 1).Trim();
}
else if (str.StartsWith("$Domain") && current != null)
else if (str.StartsWith("$Domain", StringComparison.Ordinal) && current != null)
{
current.Domain = str.Substring(str.IndexOf('=') + 1).Trim();
}
else if (str.StartsWith("$Port") && current != null)
else if (str.StartsWith("$Port", StringComparison.Ordinal) && current != null)
{
current.Port = str.Substring(str.IndexOf('=') + 1).Trim();
}
Expand Down
4 changes: 2 additions & 2 deletions src/packages/EmbedIO/Net/Internal/ListenerPrefix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public ListenerPrefix(string uri)
{
var defaultPort = 80;

if (uri.StartsWith("https://"))
if (uri.StartsWith("https://", StringComparison.Ordinal))
{
defaultPort = 443;
Secure = true;
Expand Down Expand Up @@ -58,7 +58,7 @@ public static void CheckUri(string uri)
if (uri == null)
throw new ArgumentNullException(nameof(uri));

if (!uri.StartsWith("http://") && !uri.StartsWith("https://"))
if (!uri.StartsWith("http://", StringComparison.Ordinal) && !uri.StartsWith("https://", StringComparison.Ordinal))
throw new ArgumentException("Only 'http' and 'https' schemes are supported.");

var length = uri.Length;
Expand Down
2 changes: 1 addition & 1 deletion src/samples/EmbedIO.Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private static void Main(string[] args)
{
Task.WaitAll(
RunWebServerAsync(url, ctSource.Token),
OpenBrowser ? ShowBrowserAsync(url.Replace("*", "localhost"), ctSource.Token) : Task.CompletedTask,
OpenBrowser ? ShowBrowserAsync(url.Replace("*", "localhost", StringComparison.Ordinal), ctSource.Token) : Task.CompletedTask,
WaitForUserBreakAsync(ctSource.Cancel));
}

Expand Down

0 comments on commit 55c5929

Please sign in to comment.