Skip to content

Commit

Permalink
Try to fix RavenDB-1633
Browse files Browse the repository at this point in the history
  • Loading branch information
Fitzchak Yitzchaki committed Feb 4, 2014
1 parent 03efd09 commit 64fb9dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
18 changes: 17 additions & 1 deletion Raven.Abstractions/OAuth/SecuredAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,23 @@ public async Task<Action<HttpWebRequest>> DoOAuthRequestAsync(string oauthSource
return (Action<HttpWebRequest>)(request => SetHeader(request.Headers, "Authorization", CurrentOauthToken));
}
}
catch (WebException ex)
catch (Exception e)
{
WebException ex;

var ae = e as AggregateException;
if (ae != null)
{
ex = ae.ExtractSingleInnerException() as WebException;
}
else
{
ex = e as WebException;
}

if (ex == null)
throw;

if (tries > 2)
// We've already tried three times and failed
throw;
Expand All @@ -222,6 +237,7 @@ public async Task<Action<HttpWebRequest>> DoOAuthRequestAsync(string oauthSource
}
}
}

#if SILVERLIGHT
private void BrowserCookieToAllowUserToUseStandardRequests(string baseUrl, string currentOauthToken)
{
Expand Down
10 changes: 4 additions & 6 deletions Raven.Client.Silverlight/Connection/HttpJsonRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ private async Task<string> ReadResponseStringAsync()
}
break;
case HttpStatusCode.Forbidden:
HandleForbiddenResponseAsync(webResponse);
break;
case HttpStatusCode.PreconditionFailed:
case HttpStatusCode.PreconditionFailed:
HandleForbiddenResponseAsync(webResponse);
break;
}
if (authorizeResponse == null)
Expand Down Expand Up @@ -294,9 +293,8 @@ public async Task<byte[]> ReadResponseBytesAsync()
}
break;
case HttpStatusCode.Forbidden:
HandleForbiddenResponseAsync(webResponse);
break;
case HttpStatusCode.PreconditionFailed:
case HttpStatusCode.PreconditionFailed:
HandleForbiddenResponseAsync(webResponse);
break;
}
if (authorizeResponse == null)
Expand Down

0 comments on commit 64fb9dd

Please sign in to comment.