Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan McGovern <alan.mcgovern@gmail.com>2011-08-19 15:29:16 +0400
committerAlan McGovern <alan.mcgovern@gmail.com>2011-09-23 14:29:25 +0400
commite3d33567e393de72cda9bca659f1c43c78ef79a3 (patch)
tree8d7820ad9610c78d6d6aebc8271b87abf63330e3 /main/src/tools
parent797160b0aa2085068e22eb46c53136a2f39a206c (diff)
[CrashMonitor] Set ContentLength when uploading data.
This will ensure we correctly read out all the data on the server side.
Diffstat (limited to 'main/src/tools')
-rw-r--r--main/src/tools/mdcrashlog/MonoDevelop.CrashReporting/CrashReporter.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/main/src/tools/mdcrashlog/MonoDevelop.CrashReporting/CrashReporter.cs b/main/src/tools/mdcrashlog/MonoDevelop.CrashReporting/CrashReporter.cs
index d6617b4699..60366ee004 100644
--- a/main/src/tools/mdcrashlog/MonoDevelop.CrashReporting/CrashReporter.cs
+++ b/main/src/tools/mdcrashlog/MonoDevelop.CrashReporting/CrashReporter.cs
@@ -107,16 +107,18 @@ namespace MonoDevelop.CrashReporting
Console.WriteLine ("Trying to connect to: {0}", url);
var request = WebRequest.Create (url);
request.Method = "POST";
-
- // Write the log file to the request stream
- using (var requestStream = request.GetRequestStream ())
- using (var s = File.OpenRead (report.CrashLogPath))
- s.CopyTo (requestStream);
+ using (var s = File.OpenRead (report.CrashLogPath)) {
+ request.ContentLength = s.Length;
+ // Write the log file to the request stream
+ using (var requestStream = request.GetRequestStream ())
+ s.CopyTo (requestStream);
+ }
// Ensure the server has correctly processed everything.
using (var response = request.GetResponse ()) {
- if (new StreamReader (response.GetResponseStream ()).ReadToEnd () != "OK") {
- Console.WriteLine ("Server did not respond with success");
+ var responseText = new StreamReader (response.GetResponseStream ()).ReadToEnd ();
+ if (responseText != "OK") {
+ Console.WriteLine ("Server responded with error: {0}", responseText);
return false;
}
}
@@ -130,4 +132,3 @@ namespace MonoDevelop.CrashReporting
}
}
}
-