namespace System.Net
{
-#if MOONLIGHT
- internal class WebHeaderCollection : NameValueCollection, ISerializable {
-#else
[Serializable]
[ComVisible(true)]
public class WebHeaderCollection : NameValueCollection, ISerializable {
-#endif
[Flags]
internal enum HeaderInfo
{
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)
headerValue = headerValue.Trim ();
if (!IsHeaderValue (headerValue))
throw new ArgumentException ("invalid header value: " + headerValue, "headerValue");
+
+ AddValue (headerName, headerValue);
+ }
+
+ internal void AddValue (string headerName, string headerValue)
+ {
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");
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)
+ if (value.IndexOf (',') < 0) {
+ if (separated != null)
+ separated.Add (value);
+
continue;
+ }
if (separated == null) {
separated = new List<string> (values.Length + 1);
return values;
}
+ public override string [] GetValues (string header)
+ {
+ return GetValues_internal (header, true);
+ }
+
public override string[] GetValues (int index)
{
string[] values = base.GetValues (index);
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;
return;
if ((info & headerRestriction.Value) != 0)
- throw new ArgumentException ("This header must be modified with the appropiate property.");
+ throw new ArgumentException ("This header must be modified with the appropriate property.");
}
void CheckHeaderConsistency (HeaderInfo value)