ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdateSharp/HostUpdateSharp.cs
(Generate patch)

Comparing HostUpdateSharp/HostUpdateSharp.cs (file contents):
Revision 88 by Douglas Thrift, 2004-03-01T19:03:40-08:00 vs.
Revision 93 by Douglas Thrift, 2004-03-01T23:37:27-08:00

# Line 8 | Line 8 | using System;
8   using System.IO;
9   using System.Net;
10   using System.Text;
11 #if !_FreeBSD_
12 using System.Windows.Forms;
13 #endif
11  
12   public class HostUpdateSharp
13   {
14          public static void Main(string[] args)
15          {
16 +                try
17 +                {
18 +                        new HostUpdateSharp();
19 +                }
20 +                catch (Exception exception) { Console.Error.WriteLine(exception); }
21 +        }
22 +        public HostUpdateSharp()
23 +        {
24                  StringBuilder host = new StringBuilder("host=" + Dns.GetHostName());
25                  string url = "http://topsecret.douglasthrift.net/auth/hostupdate.cgi";
26  
# Line 24 | Line 29 | public class HostUpdateSharp
29                          host.Append(".local.douglasthrift.net");
30                  }
31  
32 +                CredentialCache cache = new CredentialCache();
33 +
34 +                cache.Add(new Uri(url), "Basic", new NetworkCredential("HostUpdate",
35 +                        "frell2003"));
36 +
37                  HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
38  
39                  request.Accept = "text/plain";
40                  request.ContentLength = host.Length;
41                  request.ContentType = "application/x-www-form-urlencoded";
42 <                request.Credentials = new NetworkCredential("HostUpdate", "frell2003");
42 >                request.Credentials = cache;
43                  request.KeepAlive = false;
44                  request.Method = "POST";
45                  request.PreAuthenticate = true;
# Line 47 | Line 57 | public class HostUpdateSharp
57                          Encoding.ASCII);
58  
59                  Console.Write(content.ReadToEnd());
60 +                content.Close();
61          }
62   #if _FreeBSD_
63 <        private static string platform() { return "FreeBSD 4.9-STABLE i386"; }
63 >        private string platform() { return "FreeBSD 4.9-STABLE i386"; }
64   #else
65 <        private static string platform()
65 >        private string platform()
66          {
67                  OperatingSystem os = Environment.OSVersion;
68                  string system = "Unknown";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines