From 5ff53d153719862d6659e7b42325582f821a3185 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Jan 2009 17:18:44 -0800 Subject: [PATCH] Added trimming to XRI and URI Identifier normalization. Port of DNOI 15ac39c5f75935a273125b8e67d57acf843eb42e --- src/DotNetOpenAuth/OpenId/UriIdentifier.cs | 1 + src/DotNetOpenAuth/OpenId/XriIdentifier.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/DotNetOpenAuth/OpenId/UriIdentifier.cs b/src/DotNetOpenAuth/OpenId/UriIdentifier.cs index 339b286..4f9e0e4 100644 --- a/src/DotNetOpenAuth/OpenId/UriIdentifier.cs +++ b/src/DotNetOpenAuth/OpenId/UriIdentifier.cs @@ -418,6 +418,7 @@ namespace DotNetOpenAuth.OpenId { private static bool TryCanonicalize(string uri, out Uri canonicalUri, bool forceHttpsDefaultScheme, out bool schemePrepended) { ErrorUtilities.VerifyNonZeroLength(uri, "uri"); + uri = uri.Trim(); canonicalUri = null; schemePrepended = false; try { diff --git a/src/DotNetOpenAuth/OpenId/XriIdentifier.cs b/src/DotNetOpenAuth/OpenId/XriIdentifier.cs index 22e1f7c..b3d6375 100644 --- a/src/DotNetOpenAuth/OpenId/XriIdentifier.cs +++ b/src/DotNetOpenAuth/OpenId/XriIdentifier.cs @@ -142,6 +142,7 @@ namespace DotNetOpenAuth.OpenId { /// internal static bool IsValidXri(string xri) { ErrorUtilities.VerifyNonZeroLength(xri, "xri"); + xri = xri.Trim(); // TODO: better validation code here return xri.IndexOfAny(GlobalContextSymbols) == 0 -- 2.11.4.GIT