diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-15 11:17:28 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-15 12:59:43 -0700 |
commit | ac1215cf2838fe782a905bc8c610d7e50b7677a0 (patch) | |
tree | 03b83253be8d704ef07ada31beb49c440bc5774d /src | |
parent | 313e1bb2379fea3f78f355486b99cb584fed6f7a (diff) | |
download | DotNetOpenAuth-ac1215cf2838fe782a905bc8c610d7e50b7677a0.zip DotNetOpenAuth-ac1215cf2838fe782a905bc8c610d7e50b7677a0.tar.gz DotNetOpenAuth-ac1215cf2838fe782a905bc8c610d7e50b7677a0.tar.bz2 |
Fixes unhandled exception from OpenIdRelyingParty.IsOpenIdSupportingParameter for certain odd query strings.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs index 1c82098..7533000 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingParty.cs @@ -399,7 +399,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { NameValueCollection queryParams = this.Channel.GetRequestFromContext().QueryStringBeforeRewriting; var returnToParams = new Dictionary<string, string>(queryParams.Count); foreach (string key in queryParams) { - if (!IsOpenIdSupportingParameter(key)) { + if (!IsOpenIdSupportingParameter(key) && key != null) { returnToParams.Add(key, queryParams[key]); } } @@ -510,6 +510,11 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <c>true</c> if the named parameter is a library- or protocol-specific parameter; otherwise, <c>false</c>. /// </returns> internal static bool IsOpenIdSupportingParameter(string parameterName) { + // Yes, it is possible with some query strings to have a null or empty parameter name + if (string.IsNullOrEmpty(parameterName)) { + return false; + } + Protocol protocol = Protocol.Default; return parameterName.StartsWith(protocol.openid.Prefix, StringComparison.OrdinalIgnoreCase) || parameterName.StartsWith(OpenIdUtilities.CustomParameterPrefix, StringComparison.Ordinal); |