2 // http-get-gzip.cs: sample usage of GZipWebRequest
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // (c) 2003 Ximian, Inc (http://www.ximian.com)
18 static void GZWR (string url)
20 WebRequest req = WebRequest.Create ("gziphttp://" + url);
21 WebResponse wr = req.GetResponse ();
22 Stream st = wr.GetResponseStream ();
23 byte [] b = new byte [4096];
26 while ((count = st.Read (b, 0, 4096)) != 0) {
27 Console.Write (Encoding.Default.GetString (b, 0, count));
33 Console.WriteLine ("\nContent-Encoding: '{0}' (if empty, not compressed)",
34 wr.Headers ["Content-Encoding"]);
37 static void Main (string [] args)
39 if (args.Length != 1) {
40 Console.WriteLine ("You should provide a HTTP URL without 'http://'");