Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System/System.Net/WebHeaderCollection.cs')
-rw-r--r--mcs/class/System/System.Net/WebHeaderCollection.cs47
1 files changed, 24 insertions, 23 deletions
diff --git a/mcs/class/System/System.Net/WebHeaderCollection.cs b/mcs/class/System/System.Net/WebHeaderCollection.cs
index f41105bd5bc..e4ea21688c6 100644
--- a/mcs/class/System/System.Net/WebHeaderCollection.cs
+++ b/mcs/class/System/System.Net/WebHeaderCollection.cs
@@ -96,10 +96,6 @@ namespace System.Net
multiValue.Add ("vary", true);
multiValue.Add ("via", true);
multiValue.Add ("warning", true);
-
- // Extra
- multiValue.Add ("set-cookie", true);
- multiValue.Add ("set-cookie2", true);
}
// Constructors
@@ -155,19 +151,28 @@ namespace System.Net
throw new ArgumentException ("invalid header value: " + headerValue, "headerValue");
base.Add (headerName, headerValue);
}
-
- public override string [] GetValues (string header)
- {
- if (header == null)
- throw new ArgumentNullException ("header");
-
- string [] values = base.GetValues (header);
- if (values == null || values.Length == 0)
- return null;
-
- return values;
- }
-
+
+ public override string [] GetValues (string header)
+ {
+ if (header == null)
+ throw new ArgumentNullException ("header");
+ string [] values = base.GetValues (header);
+ if (values == null || values.Length == 0)
+ return null;
+ if (!IsMultiValue (header))
+ return values;
+ StringCollection col = new StringCollection ();
+ for (int i = 0; i < values.Length; i++) {
+ string [] s = values [i].Split (new char [] {','});
+ for (int j = 0; j < s.Length; j++)
+ s [j] = s [j].Trim ();
+ col.AddRange (s);
+ }
+ values = new string [col.Count];
+ col.CopyTo (values, 0);
+ return values;
+ }
+
public static bool IsRestricted (string headerName)
{
if (headerName == null)
@@ -260,12 +265,8 @@ namespace System.Net
if (!IsHeaderValue (value))
throw new ArgumentException ("invalid header value");
- if (IsMultiValue (name)) {
- base.Add (name, value);
- } else {
- base.Remove (name);
- base.Set (name, value);
- }
+ base.Remove (name);
+ base.Set (name, value);
}
internal void RemoveInternal (string name)