Skip to content

Commit

Permalink
Merge branch 'fix' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
lelmarir committed Feb 9, 2016
2 parents 7a20964 + 36ac9e6 commit 0695f92
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
29 changes: 18 additions & 11 deletions DotCMIS/binding/atompub/atompub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,17 +442,24 @@ protected HttpUtils.Response Read(UrlBuilder url)
// If Internal Server Error, output both request and response to the log for investigation.
if (resp.StatusCode == HttpStatusCode.InternalServerError)
{
StreamReader reader = new StreamReader(resp.Stream, Encoding.UTF8);
String responseString = reader.ReadToEnd();
Logger.Warn("----------------------------------------------------------------------");
Logger.Warn("Your CMIS server has returned: 500 Internal Server Error.");
Logger.Warn("This should never happen. It is a problem with your CMIS server.");
Logger.Warn("Please send this whole message (up to END) to your CMIS server support");
Logger.Warn("GET request sent by CmisSync:");
Logger.Warn(url);
Logger.Warn("Response received by CmisSync:");
Logger.Warn(responseString);
Logger.Warn("--------------------------- END --------------------------------------");
String responseString;
if (resp.Stream != null)
{
StreamReader reader = new StreamReader(resp.Stream, Encoding.UTF8);
responseString = reader.ReadToEnd();
}
else {
responseString = "*NULL*";
}
Logger.Warn("----------------------------------------------------------------------"+"\n"+
"Your CMIS server has returned: 500 Internal Server Error."+"\n"+
"This should never happen. It is a problem with your CMIS server."+"\n"+
"Please send this whole message (up to END) to your CMIS server support"+"\n"+
"GET request sent by CmisSync:"+"\n"+
url+"\n"+
"Response received by CmisSync:"+"\n"+
responseString+"\n"+
"--------------------------- END --------------------------------------");
}

if (resp.StatusCode != HttpStatusCode.OK)
Expand Down
10 changes: 9 additions & 1 deletion DotCMIS/binding/http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,14 @@ private static Response Invoke(UrlBuilder url, String method, String contentType
if (method != "GET" || !ExceptionFixabilityDecider.CanExceptionBeFixedByRetry(we) || retry == 5) {
watch.Stop();
Trace.WriteLineIf(DotCMISDebug.DotCMISSwitch.TraceInfo, string.Format("[{0}] received response after {1} ms", tag.ToString(), watch.ElapsedMilliseconds.ToString()));
return new Response(we);
if (we.Response != null)
{
return new Response(we);
}
else
{
throw;
}
}

retry++;
Expand Down Expand Up @@ -362,6 +369,7 @@ public Response(HttpWebResponse httpResponse)
public Response(WebException exception)
{
response = exception.Response;

this.ExtractHeader();
HttpWebResponse httpResponse = response as HttpWebResponse;
if (httpResponse != null)
Expand Down

0 comments on commit 0695f92

Please sign in to comment.