diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-04-11 22:57:32 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-04-11 22:57:32 -0700 |
commit | 36fed4cb7c6bd164f42b41d3bbfa909e9ded183f (patch) | |
tree | a8ab7990c2ea0cdb642d0366a46292c7e92d3266 /src | |
parent | 3348abf994f2abe5526454bef1a2194bba554e5c (diff) | |
parent | 5f99dec3f56da3e2b2e276c48d8836b5678bcb18 (diff) | |
download | DotNetOpenAuth-36fed4cb7c6bd164f42b41d3bbfa909e9ded183f.zip DotNetOpenAuth-36fed4cb7c6bd164f42b41d3bbfa909e9ded183f.tar.gz DotNetOpenAuth-36fed4cb7c6bd164f42b41d3bbfa909e9ded183f.tar.bz2 |
Merge branch 'v4.2' into v4.3
Conflicts:
src/version.txt
Diffstat (limited to 'src')
4 files changed, 15 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs index e1e9d53..3b9ab41 100644 --- a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs +++ b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs @@ -9,6 +9,7 @@ namespace DotNetOpenAuth.Messaging { using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; + using System.Globalization; using System.IO; using System.Net; using System.Net.Mime; @@ -318,6 +319,7 @@ namespace DotNetOpenAuth.Messaging { writer.Write(body); writer.Flush(); this.ResponseStream.Seek(0, SeekOrigin.Begin); + this.Headers[HttpResponseHeader.ContentLength] = this.ResponseStream.Length.ToString(CultureInfo.InvariantCulture); } /// <summary> diff --git a/src/DotNetOpenAuth.Core/Messaging/StandardWebRequestHandler.cs b/src/DotNetOpenAuth.Core/Messaging/StandardWebRequestHandler.cs index adca925..65d4827 100644 --- a/src/DotNetOpenAuth.Core/Messaging/StandardWebRequestHandler.cs +++ b/src/DotNetOpenAuth.Core/Messaging/StandardWebRequestHandler.cs @@ -167,7 +167,7 @@ namespace DotNetOpenAuth.Messaging { } } else { Logger.Http.ErrorFormat( - "{0} connecting to {0}", + "{0} connecting to {1}", ex.Status, request.RequestUri); } diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/BearerTokenHttpMessageHandler.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/BearerTokenHttpMessageHandler.cs index 6b2e937..2208700 100644 --- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/BearerTokenHttpMessageHandler.cs +++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/BearerTokenHttpMessageHandler.cs @@ -75,7 +75,7 @@ namespace DotNetOpenAuth.OAuth2 { protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { string bearerToken = this.BearerToken; if (bearerToken == null) { - ErrorUtilities.VerifyProtocol(!this.Authorization.AccessTokenExpirationUtc.HasValue || this.Authorization.AccessTokenExpirationUtc < DateTime.UtcNow || this.Authorization.RefreshToken != null, ClientStrings.AuthorizationExpired); + ErrorUtilities.VerifyProtocol(!this.Authorization.AccessTokenExpirationUtc.HasValue || this.Authorization.AccessTokenExpirationUtc >= DateTime.UtcNow || this.Authorization.RefreshToken != null, ClientStrings.AuthorizationExpired); if (this.Authorization.AccessTokenExpirationUtc.HasValue && this.Authorization.AccessTokenExpirationUtc.Value < DateTime.UtcNow) { ErrorUtilities.VerifyProtocol(this.Authorization.RefreshToken != null, ClientStrings.AccessTokenRefreshFailed); diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs index af60596..d121e62 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs @@ -192,7 +192,7 @@ namespace DotNetOpenAuth.OpenId.Extensions.SimpleRegistration { } /// <summary> - /// Gets or sets a combination o the language and country of the user. + /// Gets or sets a combination of the language and country of the user. /// </summary> [XmlIgnore] public CultureInfo Culture { @@ -203,7 +203,16 @@ namespace DotNetOpenAuth.OpenId.Extensions.SimpleRegistration { if (!string.IsNullOrEmpty(this.Country)) { cultureString += "-" + this.Country; } - this.culture = CultureInfo.GetCultureInfo(cultureString); + + // language-country may not always form a recongized valid culture. + // For instance, a Google OpenID Provider can return a random combination + // of language and country based on user settings. + try { + this.culture = CultureInfo.GetCultureInfo(cultureString); + } catch (CultureNotFoundException) { + // Fallback to just reporting a culture based on language. + this.culture = CultureInfo.GetCultureInfo(this.Language); + } } return this.culture; |