Переглянути джерело

2007-08-29 Atsushi Enomoto <[email protected]>

	* IPAddress.cs, IPv6Address.cs : (ToString) output ScopeId.

	* IPAddressTest.cs : added an address with scope id to parse/format
	  test.


svn path=/trunk/mcs/; revision=85016
Atsushi Eno 18 роки тому
батько
коміт
b21b41fb95

+ 4 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,7 @@
+2007-08-29  Atsushi Enomoto  <[email protected]>
+
+	* IPAddress.cs, IPv6Address.cs : (ToString) output ScopeId.
+
 2007-08-09  Atsushi Enomoto  <[email protected]>
 
 	* HttpWebRequest_2_1.cs, HttpWebResponse_2_1.cs :

+ 3 - 1
mcs/class/System/System.Net/IPAddress.cs

@@ -395,7 +395,9 @@ namespace System.Net {
 				for(int i=0; i<numbers.Length; i++)
 					numbers[i] = (ushort)NetworkToHostOrder((short)numbers[i]);
 
-				return new IPv6Address(numbers).ToString();
+				IPv6Address v6 = new IPv6Address(numbers);
+				v6.ScopeId = ScopeId;
+				return v6.ToString();
 			}
 		}
 

+ 2 - 0
mcs/class/System/System.Net/IPv6Address.cs

@@ -344,6 +344,8 @@ namespace System.Net {
 					if (i < 7) s.Append (':');
 				}
 			}
+			if (scopeId != 0)
+				s.Append ('%').Append (scopeId);
 			return s.ToString ();
 		}
 

+ 5 - 0
mcs/class/System/Test/System.Net/ChangeLog

@@ -1,3 +1,8 @@
+2007-08-29  Atsushi Enomoto  <[email protected]>
+
+	* IPAddressTest.cs : added an address with scope id to parse/format
+	  test.
+
 2007-06-28  Chris Howie  <[email protected]>
 
 	* ServicePointTest.cs: Add some loose tests for

+ 1 - 0
mcs/class/System/Test/System.Net/IPAddressTest.cs

@@ -63,6 +63,7 @@ public class IPAddressTest
 		   "::111:234:5:6:789a:0", "0:0:111:234:5:6:789A:0",
 		   "11:22:33:44:55:66:77:8", "11:22:33:44:55:66:77:8",
 		   "0:0:7711:ab42:1230::", "::7711:ab42:1230:0:0:0",
+		   "fec0:0:0:ffff::1%1",
 	};
 
 	static string[] ipv4ParseOk = new string[] {