Skip to content

Commit fe74a82

Browse files
Copilothalter73
andcommitted
Make scheme comparisons case-insensitive in IsDefaultPort
Use StringComparison.OrdinalIgnoreCase for scheme comparisons to handle HTTP/HTTPS in any case. Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
1 parent 040a1d2 commit fe74a82

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ private async Task<bool> HandleDefaultResourceMetadataRequestAsync()
7777

7878
private static bool IsDefaultPort(string scheme, int port)
7979
{
80-
return (scheme == "http" && port == 80) || (scheme == "https" && port == 443);
80+
return (scheme.Equals("http", StringComparison.OrdinalIgnoreCase) && port == 80) ||
81+
(scheme.Equals("https", StringComparison.OrdinalIgnoreCase) && port == 443);
8182
}
8283

8384
/// <summary>

0 commit comments

Comments
 (0)