This is a maintenance release until I finish the new features I’ve promised.
Changes:
- Added Proxy Support so that users behind firewall can use SO-Notifier.
- I’ve done a few changes to reduce the bandwidth overhead of the application.
As suggested by Jeff Atwood I’m using gzip http header specified to reduce network bandwidth.
It took me a while to discover how to it. Finally I came up with this code to retrieve the user web page:
public static string GetStringFromURL(string urlString, IWebProxy proxy)
{
var dataRequest = (HttpWebRequest)WebRequest.Create(urlString);
dataRequest.Timeout = 15000;dataRequest.Proxy = proxy;
dataRequest.Headers.Add(HttpRequestHeader.AcceptEncoding, “gzip,deflate”);
using (var dataResponse = (HttpWebResponse)dataRequest.GetResponse())
{
var responseStream = dataResponse.GetResponseStream();if (dataResponse.ContentEncoding.ToLower().Contains(“gzip”))
{
responseStream = new GZipStream(responseStream, CompressionMode.Decompress);
}
else if (dataResponse.ContentEncoding.ToLower().Contains(“deflate”))
{
responseStream = new DeflateStream(responseStream, CompressionMode.Decompress);
}var Reader = new StreamReader(responseStream, Encoding.Default);
var result = Reader.ReadToEnd();responseStream.Close();
return result;
}
That’s it for now. You can download the new release from its Codeplex site – let me know what you think.