dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System Uri.cs,1.31,1.32


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System Uri.cs,1.31,1.32
Date: Fri, 22 Nov 2002 14:06:31 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/System
In directory subversions:/tmp/cvs-serv12941/System

Modified Files:
        Uri.cs 
Log Message:
fixes to tests and libs so that the testsuites run


Index: Uri.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Uri.cs,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** Uri.cs      18 Nov 2002 21:44:45 -0000      1.31
--- Uri.cs      22 Nov 2002 19:06:29 -0000      1.32
***************
*** 9,12 ****
--- 9,13 ----
   * Contributions by Gerard Toonstra <address@hidden>
   * Contributions by Rich Baumann <address@hidden>
+  * Contributions by Gopal V <address@hidden>
   *
   * This program is free software; you can redistribute it and/or modify
***************
*** 28,33 ****
  {
  
- using System.Text;
  using System.IO;
  
  /*
--- 29,36 ----
  {
  
  using System.IO;
+ using System.Net;
+ using System.Text;
+ using System.Net.Sockets;
  
  /*
***************
*** 210,224 ****
                                ++toBeRemoved;
                                // removed w/o affecting toBeRemoved
!                               dirs[curDir] = "";
                        }
                        else if (dirs[curDir] == ".")
!                               dirs[curDir] = ""; // doesn't affect anything
                        else if (toBeRemoved > 0) // remove this one
                        {
                                --toBeRemoved;
!                               dirs[curDir] = "";
                        }
                        // if normal state (no .., normal dir) do nothing
                }
  
                if (toBeRemoved > 0) // wants to delete root
--- 213,232 ----
                                ++toBeRemoved;
                                // removed w/o affecting toBeRemoved
!                               dirs[curDir] = null;
                        }
                        else if (dirs[curDir] == ".")
!                               dirs[curDir] = null; // doesn't affect anything
                        else if (toBeRemoved > 0) // remove this one
                        {
                                --toBeRemoved;
!                               dirs[curDir] = null;
                        }
                        // if normal state (no .., normal dir) do nothing
                }
+               
+               if(dirs[0].Length==0) // leading slash
+               {
+                       dirs[0]=null;
+               }
  
                if (toBeRemoved > 0) // wants to delete root
***************
*** 228,232 ****
                StringBuilder newpath = new StringBuilder(oldpath.Length);
                foreach (String dir in dirs)
!                       if (dir.Length > 0) // visible?
                                newpath.Append('/').Append(dir);
  
--- 236,240 ----
                StringBuilder newpath = new StringBuilder(oldpath.Length);
                foreach (String dir in dirs)
!                       if (dir!=null) // visible?
                                newpath.Append('/').Append(dir);
  
***************
*** 249,253 ****
                foreach (String tok in name.Split('.'))
                {
!                       if (!Char.IsLetterOrDigit(tok, 0)
                            || !Char.IsLetterOrDigit(tok, tok.Length - 1)
                            || !CharsAreAlnumDash(tok, 1, tok.Length - 2))
--- 257,266 ----
                foreach (String tok in name.Split('.'))
                {
!                       if(tok.Length==0) // ".." case
!                       {
!                               isDns = false;
!                               break;
!                       }
!                       if (!Char.IsLetter(tok, 0)
                            || !Char.IsLetterOrDigit(tok, tok.Length - 1)
                            || !CharsAreAlnumDash(tok, 1, tok.Length - 2))
***************
*** 378,383 ****
        {
                int buildretval = 0;
!               int stop;
!               for (stop = index + 4; index < stop; ++index)
                {
                        if (!IsHexDigit(src[index]))
--- 391,396 ----
        {
                int buildretval = 0;
!               int stop= (index+4 <=src.Length) ? (index+4) : src.Length;
!               while(index < stop)
                {
                        if (!IsHexDigit(src[index]))
***************
*** 385,388 ****
--- 398,402 ----
                        buildretval <<= 4;
                        buildretval |= FromHex(src[index]);
+                       index++;
                }
                if (stop != index)
***************
*** 396,402 ****
                        return false;
  
!               char charloc = schemeName[0];
!               if (charloc < 'a' && charloc > 'z' &&
!                   charloc < 'A' && charloc > 'Z')
                        return false;
                for (int i = 0; ++i < schemeName.Length;) // starts with 1
--- 410,414 ----
                        return false;
  
!               if (!Char.IsLetter(schemeName[0]))
                        return false;
                for (int i = 0; ++i < schemeName.Length;) // starts with 1
***************
*** 615,619 ****
        public static bool IsHexEncoding(String pattern, int index)
        {
!               if (pattern.Length - index >= 3)
                        return ((pattern[index] == '%') &&
                            IsHexDigit(pattern[index+1]) &&
--- 627,631 ----
        public static bool IsHexEncoding(String pattern, int index)
        {
!               if (index >= 0 && pattern.Length - index >= 3)
                        return ((pattern[index] == '%') &&
                            IsHexDigit(pattern[index+1]) &&
***************
*** 785,791 ****
                                // Escape() only affects path
                                this.Escape();
!                       if (needsEscaping(query,true))
                                query = EscapeString(query);
!                       if (needsEscaping(fragment,true))
                                fragment = EscapeString(fragment);
                }
--- 797,803 ----
                                // Escape() only affects path
                                this.Escape();
!                       if (needsEscaping(query,false)) //query  = *( uchar | 
reserved )
                                query = EscapeString(query);
!                       if (needsEscaping(fragment,false)) //fragment = 
*(uchar|reserved)
                                fragment = EscapeString(fragment);
                }
***************
*** 999,1007 ****
                get
                {
!                       return (String.Equals(this.host, "localhost")
!                               // according to System.Net.IPAddress,
!                               // anything in 127.X.Y.Z
!                               // is loopback. Maybe change this to comply.
!                               || String.Equals(this.host, "127.0.0.1"));
                }
        }
--- 1011,1035 ----
                get
                {
!                       try
!                       {
!                               IPAddress ip=IPAddress.Parse(this.host);
!                               return IPAddress.IsLoopback(ip);
!                       }
!                       catch(FormatException) //must be a name
!                       {
!                               try
!                               {
!                                       IPHostEntry iph = 
Dns.GetHostByName(this.host);
!                                       foreach(IPAddress ip in iph.AddressList)
!                                       {
!                                               
if(IPAddress.IsLoopback(ip))return true;
!                                       }
!                               }
!                               catch(SocketException) // cannot resolve name 
either
!                               {
!                                       return false;
!                               }
!                       }
!                       return false; // no way out now 
                }
        }
***************
*** 1109,1113 ****
                        {
                                this.userinfo = authority.Substring
!                                 (0, interimpos1 - 1);
  
                                interimpos2 = interimpos1 + 1;
--- 1137,1141 ----
                        {
                                this.userinfo = authority.Substring
!                                 (0, interimpos1);
  
                                interimpos2 = interimpos1 + 1;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]