[hyena] Fix HttpPoster, and add server script
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Fix HttpPoster, and add server script
- Date: Wed, 26 May 2010 02:34:06 +0000 (UTC)
commit a0c1d22d2cf2d8ba5999a4f9e0dfb36a00d68198
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri Feb 12 19:35:21 2010 -0800
Fix HttpPoster, and add server script
src/Hyena/Hyena.Metrics/HttpPoster.cs | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/Hyena/Hyena.Metrics/HttpPoster.cs b/src/Hyena/Hyena.Metrics/HttpPoster.cs
index 1a37613..1a81480 100644
--- a/src/Hyena/Hyena.Metrics/HttpPoster.cs
+++ b/src/Hyena/Hyena.Metrics/HttpPoster.cs
@@ -28,14 +28,14 @@ using System;
using System.IO;
using System.Net;
-/*namespace Hyena.Metrics
+namespace Hyena.Metrics
{
public class HttpPoster
{
private string url;
private MetricsCollection metrics;
- public void HttpPoster (string url, MetricsCollection metrics)
+ public HttpPoster (string url, MetricsCollection metrics)
{
this.url = url;
this.metrics = metrics;
@@ -53,13 +53,14 @@ using System.Net;
try {
using (var stream = request.GetRequestStream ()) {
using (var writer = new StreamWriter (stream)) {
- foreach (var metric in metrics.Metrics) {
- writer.Write (metric.ToString ());
- }
+ writer.Write (metrics.ToJsonString ());
}
}
var response = (HttpWebResponse) request.GetResponse ();
+ using (var strm = new StreamReader (response.GetResponseStream ())) {
+ Console.WriteLine (strm.ReadToEnd ());
+ }
return response.StatusCode == HttpStatusCode.OK;
} catch (Exception e) {
Log.Exception ("Error posting metrics", e);
@@ -68,4 +69,4 @@ using System.Net;
return false;
}
}
-}*/
+}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]