Merge pull request #1504 from madrang/SafeHandle.SetInvalidRelease
[mono.git] / mcs / class / System / System.Net / WebHeaderCollection.cs
index d136d830d1290afce0789d856bd9db2bab597c25..2c08bf67f9f94d64574ebef0819d939491b8839f 100644 (file)
@@ -44,13 +44,9 @@ using System.Text;
     
 namespace System.Net 
 {
-#if MOONLIGHT
-       internal class WebHeaderCollection : NameValueCollection, ISerializable {
-#else
        [Serializable]
        [ComVisible(true)]
        public class WebHeaderCollection : NameValueCollection, ISerializable {
-#endif
                [Flags]
                internal enum HeaderInfo
                {
@@ -124,6 +120,14 @@ namespace System.Net
                public WebHeaderCollection ()
                {
                }
+
+
+        internal WebHeaderCollection(WebHeaderCollectionType type)
+        {
+//            m_Type = type;
+//            if (type == WebHeaderCollectionType.HttpWebResponse)
+//                m_CommonHeaders = new string[s_CommonHeaderNames.Length - 1];  // Minus one for the sentinel.
+        }              
                
                protected WebHeaderCollection (SerializationInfo serializationInfo, 
                                               StreamingContext streamingContext)
@@ -190,7 +194,7 @@ namespace System.Net
                        base.Add (headerName, headerValue);                     
                }
 
-               public override string [] GetValues (string header)
+               internal string [] GetValues_internal (string header, bool split)
                {
                        if (header == null)
                                throw new ArgumentNullException ("header");
@@ -199,7 +203,7 @@ namespace System.Net
                        if (values == null || values.Length == 0)
                                return null;
 
-                       if (IsMultiValue (header)) {
+                       if (split && IsMultiValue (header)) {
                                List<string> separated = null;
                                foreach (var value in values) {
                                        if (value.IndexOf (',') < 0)
@@ -232,6 +236,11 @@ namespace System.Net
                        return values;
                }
 
+               public override string [] GetValues (string header)
+               {
+                       return GetValues_internal (header, true);
+               }
+
                public override string[] GetValues (int index)
                {
                        string[] values = base.GetValues (index);
@@ -339,13 +348,11 @@ namespace System.Net
 
                        return sb.Append("\r\n").ToString();
                }
-#if !TARGET_JVM
                void ISerializable.GetObjectData (SerializationInfo serializationInfo,
                                                  StreamingContext streamingContext)
                {
                        GetObjectData (serializationInfo, streamingContext);
                }
-#endif
                public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
                {
                        int count = base.Count;